0
我有一个JavaScript函数,它可以处理按钮单击事件。只有当总体表单验证返回true时,我才需要该函数才能工作。我正在使用jquery验证插件来验证表单。验证工作正常,但是当我单击按钮时,即使验证存在,仍会进入函数内部。即使验证成功,按钮点击事件仍在运行
我打电话的功能是这样的:
document.getElementById('btnNext').addEventListener('click', handleFileSelect, false);
function handleFileSelect(evt) {
//My Code goes here
}
//This is my form..
<form id="someID">
<button id ="next" type="submit">
</form>
//And my validation will be as follows:
$("#posterForm").validate({
rules: {
//Here all the validation rules
},
messages: {
//Here all the error messages
}
});