Submit Form with Link


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

Trivial, but meh.


Copy this code and paste it in your HTML
  1. <a href="javascript:{}" onclick="document.getElementById('theFormName').submit();">submit</a>
  2.  
  3. or
  4.  
  5. <a href="#" onclick="return doMyBidding();">submit</a>
  6.  
  7. <script>
  8. function doMyBidding() {
  9. var answer = confirm("Are you sure you want to do my bidding?");
  10. if (answer){
  11. document.getElementById('theFormName').submit();
  12. }
  13. }
  14. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.