Home › Forums › JavaScript › if else statement issue › Re: if else statement issue
December 18, 2010 at 11:28 am
#69457
Keymaster
var test = document.getElementById('test');
var class = test.className;
if (class == 'thing') {
// yeah buddy
} else {
// nope darling
}
Remember that classes can be space-separated though, so you’d likely need to split them into an array based on spaces and then loop through that array testing each one.