NYPD / ritsu.js

HTML form validation
MIT License
2 stars 0 forks source link

If an input is not in a form-group and it valid, exception gets thrown #56

Closed NYPD closed 7 years ago

NYPD commented 7 years ago
  var errorElement = useBootstrap3Stlying ? _getClosestParentByClass(element, 'form-group') : element;

  var isInvalid = element.getAttribute('data-invalid') === 'true';

  if (isInvalid)
    errorElement.classList.add('has-error');
  else
    errorElement.classList.remove('has-error');

errorElement will be null therefore not be able read the property classList of null.

So basically if it can not find the form-group, use the element itself