form-validation
form-validation copied to clipboard
Bootstrap 5 row selector
I'm using bootstrap 5
plugin. There is a rowSelector: ".row",
which causes errors. If there is no row class it throws error and crashes application.
There is plenty of examples where there will be no row class.
For example form-floating
variation: https://getbootstrap.com/docs/5.1/forms/floating-labels/
I know (now :/) that we can change row selectors, but if there is a good error message I can get to it much sooner :)
EDIT: Maybe something like this would be better:
rowSelector: function (field, ele) {
if (ele.parentElement && ele.parentElement.classList && ele.parentElement.classList[0]) {
return '.' + ele.parentElement.classList[0];
}
return '.row';
}
@piernik I will add a warning in the console
in the next version.
Thanks for the suggestion.
@phuoc-ng I edited my answer to suggest better (in my opinion) solution for selector