You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<form><div><label>Name</label><inputtype="text" required></div><div><label><inputid="dAgree" type="checkbox"><span>I agree with the terms and conditions</span></label></div><button>Submit</button></form>
JS
$('form').bazeValidate({onValidating: function(e){if(!$('#dAgree').is(':checked')){e.preventDefault();$('#dAgree').parent().after('<div class="msg-error">You have to agree.</div>')}},onValidated: function(e){e.preventDefault()alert('thank you!')}});
The snippet above would reach alert when the input text is filled and checkbox is unchecked. onValidated function should not run if the event is defaultPrevented in onValidating callback.
The text was updated successfully, but these errors were encountered:
Given markup
JS
The snippet above would reach alert when the input text is filled and checkbox is unchecked.
onValidated
function should not run if the event is defaultPrevented inonValidating
callback.The text was updated successfully, but these errors were encountered: