I have few classnames like this:
<div class=".error .error-code-123">
Now I want to to check whether the .error class has any .error-code-SOME_NUMBER.
I tried something like this:
$(".error").hasClass(/.error-code-[0-9]/)
Just trying to use regex here, which does not work. How can I check the above scenario using jquery?
dataattribute instead of aclass. That way you know exactly how to retrieve the value, and can select the elements by it, instead of having to loop over them all and hack theclassstring around with a regex.