I have a single text box with no submit button on form as below :
<html>
<form action="http://www.google.com">
<input type="text"/>
</form>
</html>
when text box is selected and i press enter key form will get submitted and google page will be displayed. however if i have two text box as bellow :
<html>
<form action="http://www.google.com">
<input type="text"/>
<input type="text"/>
</form>
</html>
now if i press submit button nothing will happen.
Can anyone explain here :
i) why form is get submitted in first case?
ii) why form is not submitting in second case?
HTML 2.0 Specs:
When there is only one single-line text input field in a form, the user agent should accept Enter in that field as a request to submit the form.
The easiest way to disable this behavior is to add a hidden input field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With