I want my Submit button disable until the elements in the form are not filled..!
I am using Laravel 5.4
There are only 3 fields out of which one is textbox and another is email and another is a select with options. Here is my Form..!
{{ Form::open(array('url' => 'student', 'id' => 'frmReg')) }}
<div class="form-group">
    <label>Name:</label>
    <input type="text" name="name" id="name" class="form-control">
    <div id="aName" style="color:red"></div>
</div>
<div class="form-group">
    <label>Email:</label>
    <input type="email" name="email" id="email" class="form-control">
    <div id="aEmail" style="color:red"></div>
</div>
<div class="form-group">
    <label id="gen">Gender:</label>
    <br>
    <select name="gender">
        <option value="Male">Male</option>
        <option value="Female">Female</option>
    </select>
</div>
<button class="btn btn-primary" id="sub">Create a student</button>
{{ Form::close() }}
Here is my jQuery script
<script>
var isValid=0;
    $(document).ready(function(){
       $("#frmReg").validate({
            rules: {
                name: {
                    required: true
                },
                email: {
                    required: true
                }
            },
            messages: {
                name: "Name is Empty",
                email: "Enter a valid Email ID..!"
            },
            submitHandler: function(form) { // <- pass 'form' argument in
                $("#sub").attr("disabled", true);
                form.submit(); // <- use 'form' argument here.
            }
        });
});
</script>