trickyjw — 2011-10-28T00:51:59-04:00 — #1
Hello I've been trying to figure out with a search box I've added how it can submit by pressing the 'enter' key rather than just clicking a 'submit' button beside a form. I've tried onkeypress but as soon as you press one button the field submits. I've also seen you can do with keycode==13 but I'm not sure how to add it into my code. I've pasted my code in below. Any help would be much appreciated.
<input type="text" name="Search" id="Search" class="searchBox" />
<a href="#" onclick="getContentURL(Search.value);"><img src="/img/magnifying-glass.gif" class="searchImg" /></a>
felgall — 2011-10-28T03:54:17-04:00 — #2
The input field needs to be inside a form - both to be valid and for the enter key to be able to trigger whatever is attached to the action attribute of the form tag.
trickyjw — 2011-10-30T06:55:53-04:00 — #3
Great thank you for your help. Worked well.