I have
Html:
<form action="" method="post" id="contactForm">
<input id='inputbox' name="inputbox" type="text" />
<button type="button" id='search'> search </button>
</form>
JavaScript
$(document).ready(function() {
$("#inputbox").keyup(function(event){
if(event.keyCode == 13){
$("#search").click();
}
});
$('#search').click(function(){
var inputbox= $("#inputbox").val();
//stuff
});
});
inputbox value is nothing when I press enter, however if I click on button It works perfectly with same input value
maybe making inputbox global?