javascript - Submit when enter is pressed on number input -
i want make when press enter when clicked on number input box
<input id="answer" type="number" style="display: none;" placeholder="answer box"/> it runs function
nextquestion() i want when press enter runs function
use can use .keypress() , .click() function in jquery bind multiple events same function
$('#answer').keypress(function(e){ if(e.which == 13) //enter key code 13, capture when enter key pressed nextquestion(); }); $('#answer').click(function(e){ nextquestion(); });
Comments
Post a Comment