Reputation: 8981
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?
Upvotes: 0
Views: 638
Reputation: 943217
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.
Upvotes: 2
Reputation: 29032
Many web developers, like myself, just prefer being "different."
There is no right or wrong way to make a submit button, hell, you could make it an image...
It's just a practice, and many times, links look much prettier than buttons. Pure preference
Upvotes: 0