I know that somewhere someone asked this question before but I've tried to find an answer without any luck.
I'm trying to find if an exact substring is found in a string.
For example
<input class="form-control alphanumeric-chars" /> I want to match 'alphanumeric-characters' but if the class name was alphanumeric it won't be a match
I've tried many options like:
$('input').filter(function() { return $(this).className.includes('alphanumeric-chars'); }) Or
return $(this).className === 'alphanumeric-chars'; Any idea what am I missing?
hasClassmight help. See here.element.classList.contains("classname")