IE highlighting first submit button

134 views Asked by At

I have around 10 buttons on a web app. IE keeps highlighting the first button by default. I dont want any of the buttons highlighted. I've tried adding this per Stopping IE from highlighting the first submit-button in a form

useSubmitBehavior="false"

which works fine but also disables the postback of the button.

Any other suggestions?

Update:

<asp:Button ID="first_btn" runat="server" Text="Some Text" 
onclick="first_btn_Click" CssClass="button" />
<asp:Button ID="second_btn" runat="server" Text="Some Text" 
CssClass="button" onclick="second_btn_Click" />
<asp:Button ID="third_btn" runat="server" Text="Some Text" 
CssClass="button" onclick="third_btn_Click" />
<asp:Button ID="forth_btn" runat="server" Text="Some Text" 
CssClass="button" onclick="forth_btn_Click" />
<asp:Button ID="fifth_btn" runat="server" Text="Some Text" 
CssClass="button" onclick="fifth_btn_Click" />
1

There are 1 answers

3
tiktak On

Once the page is loaded, trigger

document.getElementById("myButton").focus();

supposing your button is defined as <button id="myButton">Send</button>.