I have the following code:
var testAnswer = $(this).attr("class");
and then a check like so:
if (testAnswer === "true") { /* some jazz */
This works fine if I have class="true" but NOT if I have class="true single-line" presumably because I’m looking for an exact match instead of if it contains the word true in the class.
How do I do this?
Thanks
Look at the jQuery hasClass() function.