Jump to content

TextBox Problem


ZeroShade

Recommended Posts

I have an asp textbox on my masterpage used for searching throughout the site. However, if the user is to push enter at any time the default textbox selection is always that search box. How can I keep this text box from being selected if the user accidentally pushes enter on the page?

Link to comment
Share on other sites

I believe that the enter button will submit whichever form has focus, and I believe that when the page initially loads it will give the first form focus, even if it hasn't been clicked on. I'm not positive that that's how it works, but that's what I think. If so, you can add some Javascript to remove focus from the form. Make sure you give an ID to your textbox so that Javascript can reference it.

<script type="text/javascript">document.getElementById("textbox_id").blur();</script>

Add that to the bottom of the page.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...