Is there any reason that most information I see about form submission via Javascript is done with anchor links:
<a id="submitButton" href="#">Submit</a>
instead of
<button id="submitButton">Submit</button>
Javascript:
$("#submitButton").click(function(){
//do whatever
});
I cannot think of any reason that this is the standard practice, but maybe I am missing something?
Historically, it was been easier to style links to look like Not A Standard Button then rig up form submission with JS (calling the
submit()method, doing something ajaxy, etc) instead of styling a real button.There’s no reason to beyond the cosmetic, and the lack of graceful degradation gives a good reason not to.
Use a regular submit button.