I want submit form for Jquery dialog by pressing enter key.
HTML
<!-- Pin Notification Form -->
<div id="pin-dialog-form" title="Verification Pin">
<div id="agent_pin_container">
<input type="password" name="verification_pin" id="verification_pin"
value="" class="form-control" placeholder="Verification Pin" />
</div>
</div>
JQUERY
$( "#pin-dialog-form" ).dialog({
autoOpen: false,
height: 200,
width: 300,
modal: true,
buttons: {
"Submit": function() {
// PROCESS
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
$( this ).dialog( "close" );
}
});
Now, I can not use this type of code in here, if (e.keyCode == 13) {
. Because, the form is submitted by modal window itself. on the other hand I can not use this,
open: function() {
$(this).parents('.ui-dialog-buttonpane button:eq(0)').focus();
}
because, I need to enter PIN first then focus on submit button. Is there any other way to do it? Thanks.