Object.hasClass()
Update: For compatibility, Object.hasClass(className) is being changed to simply hasClass(node, className).
Inspired by the dojo toolkit, this function checks to see if a given class is assigned to a node. Simply run it like this:
var my_node = document.getElementsById(”mydiv”);
if( hasClass(my_node, “myclass”) ) {
// …do something
}
Enough talk; here’s the code:
function hasClass( /*HTMLElement:*/node, /*String:*/value ) {
return [...]