On a website I'm working on, when you click sign on, a jquery dialoge modal pops up, but you have to click on OK to submit the form, you can't just hit enter. I need it to be able to have enter work also. It seems like what I have should work, but it doesn't
I'm using jquery-1.3.2.js. I also have a php file with the following piece of code in it: `
<tr valign="top" align="right" style="height:40px"><td >
<div id="signin">
<table style="margin-top:4px;margin-right:4px;border-style:solid;border-width:1px">
<tr><td style="width:165px;">
<div><center>
<a title="Sign In" onclick="LoginDialogOpen()" href="javascript:void();">Sign In</a><b> | </b>
<a title="Create Account" href="CreateAccount.html">Create Account</a>
</center></div>
</td></tr>
</table>
</div>
</td></tr>
Email:
Password:
</div>
<script>
$('#login_dialog').dialog({
autoOpen: false,
width: 310,
overlay: { opacity: 0.5, background: "black" },
modal: true,
buttons: {
"Ok": function() {
$("body").addClass("curWait");
sql = "select client_id from users where email = '" + $("#email")[0].value + "' and login_password='" + $("#password")[0].value + "'";
$.get('BongoData.php', { task:"SQLResultToJSON", sql: sql}, ResultOfLoginAttempt, "json");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
</script>`
i have a javascript file with the following function:
function LoginDialogOpen(){
$('#login_dialog').dialog('open');
$('#login_dialog').keypress(function(e) {
if (e.which == 13) {
$("body").addClass("curWait");
sql = "select client_id from users where email = '" + $("#email")[0].value + "' and login_password='" + $("#password")[0].value + "'";
$.get('BongoData.php', { task:"SQLResultToJSON", sql: sql}, ResultOfLoginAttempt, "json");
}
});
}
That is the code I have, I don't understand why it isn't working.
I also had it try $('#login_dialog').dialog('isOpen'); right after i opened it, but it always returned false oddly enough. Please help if you can.