I have a bunch of inputs like this
<input id="someId" type="button" class="SomeClass" onclick="determineClass(this.id, event)" />
From javascript I would like to get the class, it’s different for each input.
function determineClass(id, e) {
var elementClass = //Somehow get the class here
}
It can be using jQuery or just plain javascript… Does anyone know how to do this?
Thanks,
Matt
If your input has multiple classes,
attr('class')returns a space-delimited list of classnames. You can get the last one as follows:See
Attributes/attr