jQuery Validate with Summernote Editor error: Cannot read property 'replace' of undefined
I use this script to tell the validator to ignore Summernote elements. It can be tweaked to ignore elements generated by other HTML editors.
$('form').each(function () {
if ($(this).data('validator'))
$(this).data('validator').settings.ignore = ".note-editor *";
});
If you ever encounter this issue with the quill (rich text editor) when validating forms with jQuery validator, simply do the following:
$('#id-of-form-to-validate').validate({
ignore: ".ql-container *"
// continue validation
});
Where '#id-of-form-to-validate' could simply be an id, class or form element.
the cleanest approach without hardcoded Ids comes from JQuery.Validate github discussion it self:
jQuery.validator.setDefaults({
// This will ignore all hidden elements alongside `contenteditable` elements
// that have no `name` attribute
ignore: ":hidden, [contenteditable='true']:not([name])"
});
Souce: https://github.com/jquery-validation/jquery-validation/issues/1875