Clicando em um link quando a tecla enter é pressionada usando jQuery
Eu estou tentando fazer assim quando um usuário está em uma caixa de texto e eles pressionam enter, é o mesmo que clicar no link, caso em que deve levá-los para outra página. Aqui está o que eu tenho e não funciona.
O 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();
}
});
});
A marcação<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>