I'm trying to make it so when a user is in a text box and they press enter, it is the same as clicking the link, in which case it should take them to another page. Here's what I have and it doesn't work.
The code
//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();
}
});
});
The markup
<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>