JQuery.validate is manually started before saving

I have a save button (enter button) in which I wrote javascript code to save form data in a database. My jQuery.validate function does not run until the form is saved. How can I manually execute my jQuery.validate function before saving. That's what I'm doing.

<input type="button" class="saveSubmit" name="action" value="Save" />

// Give user feedback when clicking save
$(".saveSubmit").click(function() {
    if (save() == true) {
        alert("Email has been saved.");
    } else {
        alert("Error saving email.");
    };
    return false;
});

// Validation
$("#emailForm").validate({ 
    // rules here 
});
+3
source share
1 answer

Found. I need to use $("#emailForm").valid().

+9
source

Source: https://habr.com/ru/post/1786457/


All Articles