Quote OP:
"The page just refreshes and doesn't show the message."
It's not validating because you are not properly initializing the plugin. Since you put the .validate()
method within a click
handler, the plugin is not initialized until after the click... by that time it's too late.
You should never need to call .validate()
within a function, click handler, etc.
// the click handler is not needed - delete this...
//$("#submission").on("click", function (evt){
// handleAddForm();
// return false;
//});
Simply placing .validate()
within the DOM ready handler will properly initialize the plugin. Then the plugin will automatically capture the click of the submit button.
$(document).ready(function() {
$('#manage-form').validate({ // initializes the plugin
// your rules and options
});
});
Use pageinit
for jQuery Mobile "ready" event...
$(document).on('pageinit', function(){
$('#manage-form').validate({ // initializes the plugin
// your rules and options
});
});