Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid internet explorer first button selection?

I have one form with several text fields and one button. When i enter one of the text fields, the submit button become highlighted and if i press enter while typing, the button is pressed, so i got an unexpecte behaviour because my page is submitted. Firefox doesn't act such a way.
Is there some attribute or configuration to avoid this undesired behaviour or i have to use some javascript technique?

like image 855
M3rlino Avatar asked May 23 '26 18:05

M3rlino


2 Answers

Generally what I do in this situation is make the first button on the form do nothing and then hide it with CSS. Kludgy? Sure. Effective? Absolutely.

In fact, this is a duplicate of Stopping IE from highlighting the first submit-button in a form.

like image 91
cletus Avatar answered May 26 '26 07:05

cletus


You need to disable the Enter key for those input elements to prevent form submission. Take a look at this article.

like image 29
Peter Avatar answered May 26 '26 09:05

Peter