I am using the ajax function. When I select any offer using the enter key, the form is automatically submitted because the submit button is automatically focused. Is there a way to select an ajax offer using the enter key, and also send a form using the enter key. Something like, when I enter the values of all fields, then only the submit button is turned on.
What do you call your Ajax function? It must be inside the submitform event handler . And then, if you have a returned event handler false, it will not be sent normally:
submit
false
<form onsubmit="doAjaxSubmit(); return false;"> ... </form>
You can determine which key is pressed using the method .keypress(). From this, you should be able return false;to submit the form and do your ajax stuff on the back of the instructions if:
.keypress()
return false;
if
http://api.jquery.com/keypress/
You can have the form onSubmitreturn trueif all fields have values or falseif they do not.
onSubmit
true