Forum Moderators: open

Message Too Old, No Replies

how to make enter key trigger input type button

how to make enter key trigger input type button

         

drooh

10:57 pm on Oct 8, 2008 (gmt 0)

10+ Year Member



Ok, I have a google store locator set up on my site. it uses an input type button to fire an onclick="searchLocations()"

the problem is that I need the enter key when pressed to also perform the searching

is there a way to make the enter key trigger the javascript function searchLocations() ?

something like
onclick,onEnterKey="searchLocations()"

drooh

11:42 pm on Oct 8, 2008 (gmt 0)

10+ Year Member



<input onkeydown="if (event.keyCode == 13) document.getElementById('searchLocations').click()" type="text" id="addressInput" size="45" />

<input type="button" onclick="searchLocations()" id="searchLocations" value="Search For Store"/>

drooh

11:42 pm on Oct 8, 2008 (gmt 0)

10+ Year Member



thanks drooh!