spudly.shuoink.com

the best way to predict the future is to implement it

Entries Comments


more class functions…

6 December, 2007 (19:35) | JavaScript | 4 comments

Update: changed from Object.prototype.hasClass(className) to simply hasClass(element, className) for cross-browser compatibility
Ok… nothing to revolutionary here. This has been done before lots of times. I’ve written two new functions to go along with my hasClass() javascript function.
First is addClass(), which simply adds a class to an object, while preserving the existing classes. Here it is:
function addClass( [...]