Reputation: 13192
On the highlight, I try like this :
unhighlight: function (element, errorClass, validClass) {
if(element.prop("class") == "test")
document.getElementById('error-message-test').style.display = 'none';
}
There exist error :
element.prop is not a function
How can I solve this error?
Upvotes: 1
Views: 1788
Reputation: 68933
You can use jQuery
to wrap your element or with hasClass
like:
if($(element).prop("class") == "test")
Or
if($(element).hasClass("test"))
Upvotes: 3
Reputation: 474
You can use hasClass method of jQuery if an element has class or not.
General syntax
if($(element).hasClass('className'))
Based on your scenario
if($(element).hasClass('test'))
Upvotes: 1