Abdul Waheed Abdul Waheed - 1 year ago 86
Ajax Question

How can i allow enter button to submit form

Hi i am trying to send form using enter button usually by default when i click enter the form will submit but in this oage i am unablr to proceed to form submit when i press enter button.

i can submit the form only by using mouse click on "login" i am sending with ajax

enter image description here

hi this my llogin form:

<form class="form-horizontal" id="loginForm" >
<div class="form-group has-feedback">
<input type="text" class="form-control" placeholder="Email" name="login_email" id="login_email">
<div class="form-group has-feedback">
<input type="password" class=" form-control" placeholder="Password" name="login_password" id="login_password">
<div class="text-center form-group">
<input type="button" name="login_button" id="login_button" class="btn btn-default btn-block btn-primary" value="LOG IN">
<p class="small">
<h6 class="text-center"><a href="forgot-password.php">
Forgotten account Password?</a></h6>
<div class="processloader_login"></div>
<div class="form-group">
<a href="signup.php " class="btn btn-block btn-success">CREATE AN ACCOUNT</a>

Answer Source

you don't have a submit button try a keypress event & the submit() function

if (e.keyCode == 13)

or change

<input type="button" to a type submit

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download