I have a dynamic div that can generate over 1000 different classes ... its a wordpress theme.
Now I want to check if the div has one of 52 classes.
.bg1, .bg2, .bg3, etc. etc.
I know that you can use hasClass ();
But how can I check each of them and then get the value. For example, here is a div, as it stands
<div id="wordpresspost" class="bodyclass post-id-193 wordpresswrap bg1"></div>
Please note that I really don't know jquery: D
I thought it would be something like this, but logically this does not make sense to me :(
var divclass = $("#wordpresspost").hasClass('bg1, bg2, bg3, bg4, bg5, bg6');
if(divclass == true){
var divsclass = $(this);
}
I need to know the class because I want to change it, for example, I would like .removeClass and then addClass a new class without changing the rest, since they are dynamic
Thanks in advance for your advice :)