Haciendo clic en un enlace cuando se presiona la tecla Intro usando jQuery
Estoy tratando de hacerlo cuando un usuario está en un cuadro de texto y presiona Intro, es lo mismo que hacer clic en el enlace, en cuyo caso debería llevarlo a otra página. Esto es lo que tengo y no funciona.
El código//jQuery
$(document).ready(function() {
//if focus is in the input box drivingSchoolInput
$("#drivingSchoolInput").live("click", function() {
//if enter key is pressed
if(e.keyCode == 13) {
//click the button and go to next page
$("#button1").click();
}
});
});
El marcado<form>
<div class="formDiv">
<label for="City">Search by Driving School</label>
<span class="inputBox"><input type="text" name="City" class="input" id="drivingSchoolInput" /></span>
</div>
<h4 class="submitButton"><a href="school.html" id="button1">Submit</a></h4>
</form>