If my web page has several buttons, how can I make one of the buttons the default button so that when the user presses the enter key, the default button is activated?
I don't really want it to have the focus, I just want it to be the default if more than one button exists and the user presses enter to activate the default button.
I've seen this done and trying to figure out how it was accomplished. This would be like setting a command button as the default in a VB form.
Make the default button a submit button
<input typ=submit name="btnname" value="Submit">
and the other buttons
<input type="button" name="btnName" value="whatever">
By default, when the user presses enter, the submit button is the one that is activated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.