Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input Button as SUBMIT

I need to have a form submitted using the enter key, however, I have to use a BUTTON instead of SUBMIT as the type in order for the page to not refresh. How can I get my BUTTON to act as a SUBMIT and be executed whenever someone pushes their enter key?

<form>
<input type=text ...>
<input type=button ...>
</form>

A lot of the information I found about this mentions Netscape/IE/lots of outdated material.

This is my HTML output, I'm looking to hide the submit button and use ENTER:

https://i.sstatic.net/Ohepe.png


1 Answers

with Javascript enabled

<input type="button" onclick="this.form.submit()" ... /> 

should work

like image 66
wonk0 Avatar answered Apr 02 '26 07:04

wonk0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!