A simple example of use

Html:

<form method="post" id="form">
    <div class="row">
        <div class="col-md-12">
            <input type="text" id="labelLogin" class="form-control" data-field="login">
            <label for="labelLogin">Login (email) *</label>
            <div class="valid-message"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <input type="password" id="labelPassword" class="form-control" data-field="password">
            <label for="labelSurname">Password *</label>
            <div class="valid-message"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <button class="btn btn-primary" type="submit">LOGIN</button>
        </div>
    </div>
</form>

JavaScript:

<script>
    var form = $('#form').formValid({
        fields: {
            "login": {
                "required": true, 
                "tests": [
                    {
                        "type": "null", 
                        "message": "Not entered login"
                    },
                    {
                        "type": "email", 
                        "message": "Your email is incorrect"
                    }
                ]
            },
            "password": {
                "required": true,
                "tests": [
                    {
                        "type": "null", 
                        "message": "Not entered password"
                    }
                ]
            }
        }
    });
    
    form.keypress(300);
    
    $('button[type="submit"]').click(function() {
        form.test();
        if (form.errors() == 0) {
            alert('Ok');
        }
        return false;
    });
</script>