I have a small example to share with you:
HTML CODE:
<div class="body">
<div class="test">TEST</div>
</div>
JS CODE:
switch (className) { //instead of n, I need to write className
case body:
alert("my class is body");
break;
case another_class:
alert("my class is another");
break;
default:
//etc
}
I simply want to test if my class exists one at a time using a switch statement.
Each page on my site has different classes in the body, and I want to apply styles only if a certain class is present...
I hope I have explained my idea clearly, if not, please let me know.
Thank you in advance!