So, I have a form and 2 buttons, 1 button is only for verifying email, meanwhile the other button is the form submit button. I'm using jQuery validation to validate the form.
What I want is it should only the SUBMIT button that can submit the form through submitHandler and execute alert("success"), but whenever I click the VERIFY button, it also submit the form through submitHandler and execute alert("success").
Here is the script:
index.html:
<form id="form_data">
    <div class="form-group">
        <label>Phone Number</label>
        <input id="phone_number" name="phone_number" required>
    </div>
    <div class="row">
        <div class="form-group col-9">
            <label>Email</label>
            <input id="email" name="email" required>
        </div>
        <div class="form-group col-3">
            <button id="btn_email">VERIFY</button>
        </div>
    </div>
    <div>
        <button id="form_data_submit" type="submit">SUBMIT</button>
    </div>
</form>
script.js
jQuery(document).ready(function () {
    var btnSubmitEl = $("#form_data_submit");
    var formEl = $("#form_data");
    formEl.validate({ // initialize jquery validation plugin
        rules: {
            phone_number: {
                required: true,
                number: true,
                minlength: 7,
                maxlength: 12
            },
            email: {
                required: true,
                minlength: 7,
                maxlength: 20
            }
        },
        submitHandler: function (form) {
            alert("success")
            return false;
        }
    });
});
Am I missing something here?
Thanks
 
     
     
    