Published
- 1 min read
how to check if an element starts with class in jquery
The solution for this is noted below
how to check if an element starts with class in jquery
Solution
/*SM*/
//Try using :
$('[class^=info_]') //Classes Starts with info_
$('[class*=info_]') // Classes which contains info_
//instead of hasClass
if ($('label').is('[class*=info_]')) {
} //Contains
//or
if ($('label').is('[class^=info_]')) {
} //Starts with
Try other methods by searching on the site. That is if this doesn’t work