3

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

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>
    <div class="form-group has-feedback">
        <input type="password" class=" form-control" placeholder="Password" name="login_password" id="login_password">
    </div>
    <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">
    </div>
    <p class="small">
        <h6 class="text-center"><a href="forgot-password.php">  
        Forgotten account Password?</a></h6>
        <div class="processloader_login"></div>
    </p>
    <div class="form-group">    
        <a href="signup.php " class="btn btn-block btn-success">CREATE AN ACCOUNT</a>
    </div>
</form>
Mr world wide
  • 4,696
  • 7
  • 43
  • 97

2 Answers2

6

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

$('body').keypress(function(e){
if (e.keyCode == 13)
{
    $('#loginForm').submit();
}
});

or change

<input type="button" to a type submit

madalinivascu
  • 32,064
  • 4
  • 39
  • 55
2
document.onkeydown=function(){
    if(window.event.keyCode=='13'){
        document.form.submit();
    }
}
Bhavik
  • 495
  • 2
  • 10