Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping IE from highlighting the first submit-button in a form

The expected behaviour on enter in a form seems to be undefined in the HTML 4.01 Specification while the HTML 5 specification says it should be the first submit button in the form.

Internet Explorer (IE) highlights the first button in the form when the form has focus by adding a proprietary border or something. Other browsers do not add such a visual clue.

I'd like to use another button as the default and style this button so all browsers will provide a visual clue that it is the default button. (We're using ASP.NET which uses one form per page, and so it's hard to design the pages so that the default button always comes first.)

While I can easily accomplish this with javascript and css in most browsers, I'm having trouble making IE stop highlighting the first button.

Is there any way to tell IE to NOT highlight the first submit-button or to highlight a different button? Or is there some other solution that I've missed?

like image 417
Alf Avatar asked Jan 14 '09 10:01

Alf


People also ask

How do I customize a submit button?

The simplest way to do this is by using the WordPress CSS Editor. To open this, go to Appearance » Customize and select Additional CSS. Once you've opened the Additional CSS section, you can paste in your new CSS, click the Save & Publish button, and you're all set!

Which one of the following javascript method removes focus from a submit button?

Tip: Use the blur() method to remove focus from a submit button.

What happens when you click the submit button?

Most HTML forms have a submit button at the bottom of the form. Once all of the fields in the form have been filled in, the user clicks on the submit button to record the form data. The standard behaviour is to gather all of the data that were entered into the form and send it to another program to be processed.


1 Answers

On your asp.net button control, set useSubmitBehavior="false". That renders the html as a button rather than a submit.

like image 114
TK. Avatar answered Nov 15 '22 18:11

TK.