I would like to write a jQuery ‘plugin’ that essentially accepts a CSS class and denies it from ever being added to a given selector. Is this even possible? I cannot figure out how to actually intercept the addClass method and check it without going into the jQuery source code – and my experience with javascript is not nearly strong enough to be comfortable trying that. Plus I am loading jQuery through a CDN, so I’d rather not muck around in its source.
I would like to write a jQuery ‘plugin’ that essentially accepts a CSS class
Share
You could overwrite it like this if you accept hardcoding denied classes. You can add this anywhere, it will simply ‘patch’ jQuery with an enhanced
addClassfunction.http://jsfiddle.net/pimvdb/A8ePY/1/