Tuesday, October 23, 2012

How to set "Search" button as default on Enter using Javascript

How To set Default Button for ENTER key pressed event?


Setting enter key default button when login control and search ?

You can submit a form when you enter something in a search field and press Enter (Return) button on keyboard using javascript code.

<input type="text" name="searchFor"
onkeydown="if(event.which || event.keyCode)                                                    {if ((event.which == 13) || (event.keyCode == 13))                                                    {document.getElementById('your search button ID').click/>

No comments:

Post a Comment