Posted By

wjbrown on 06/26/09


Tagged

form anchor submit a


Versions (?)

jQuery submit form with an anchor tag


 / Published in: jQuery
 

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.

  1. $(document).ready( function(){
  2.  
  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. });
  8.  
  9. });

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: adriamooney on September 3, 2010

can you show an example of how to make it submit the link by pressing the Enter key?

Posted By: adriamooney on September 3, 2010

can you show an example of how to make it submit the link by pressing the Enter key?

Posted By: adriamooney on September 3, 2010

can you show an example of how to make it submit the link by pressing the Enter key?

Posted By: adriamooney on September 3, 2010

can you show an example of how to make it submit the link by pressing the Enter key?

You need to login to post a comment.