how to disable submit button until a form is filled

If you trying to disable a submit button until a form is filled then you can do this easily using Jquery. With help of Jquery you can disable a submit button until last text field is filled out and after that button is enabled to submit a form data.


    Username<br />
    <input type="text" id="user_input" name="username" /><br />
    Password<br />
    <input type="password" id="pass_input" name="password" /><br />
    Confirm Password<br />
    <input type="password" id="v_pass_input" name="v_password" /><br />
    Email<br />
    <input type="text" id="email" name="email" /><br />     
    <input type="submit" id="register" value="Register" disabled="disabled" />


(function() {
    $('form > input').keyup(function() {

        var empty = false;
        $('form > input').each(function() {
            if ($(this).val() == '') {
                empty = true;

        if (empty) {
            $('#register').attr('disabled', 'disabled');
        } else {

Leave a Reply

Your email address will not be published. Required fields are marked *