The following form triggers a JavaScript function upon the user pressing enter. However, I'd like the function to be triggered when the user presses a submit button.
<form action="">
<input type="text" name="query" size="20" class="hintTextbox" id='emailinput' placeholder='email'>
<input type="text" name="query" size="20" class="hintTextbox" id='variablesinput' placeholder='variables'>
</form>
$('#variablesinput').keypress(function (e) {
if (e.keyCode == 13) {
var email = $('#emailinput').val();
var variable = $('#variablesinput').val();
alert(email + variable);
}
});
Also, see here: https://jsfiddle.net/chrisguzman/7Tag3/5/
on submit