jQuery submit form with an anchor tag

/ Published in: jQuery
Save to your folder(s)

Just a little bit of code if u are interested in using links for form submission. I'm aware of the dangers of using links in this case, but don't really care. They're way easier to style.

Copy this code and paste it in your HTML
  1. $(document).ready( function(){
  3. // bind "click" event for links with title="submit"
  4. $("a[title=submit]").click( function(){
  5. // it submits the form it is contained within
  6. $(this).parents("form").submit();
  7. });
  9. });

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.