1var classList = $('#divId').attr('class').split(/\s+/);
2$.each(classList, function(index, item) {
3 if (item === 'someClass') {
4 //do something
5 }
6});
1$('#elementID').prop('classList').add('yourClassName')
2$('#elementID').prop('classList').remove('yourClassName')
1var classes = $('#test').attr('class').split(' ');
2
3alert(classes[0]); // first class
4alert(classes[1]); // second class
5alert(classes[2]); // third class