I have the following piece of code:
if((String(parent).length > 0) && (String(this.className).length > 0)) {
where this.className contains the value "top currentMenu"
Using this.className name, I need a means of removing from this.className, "currentMenu" ONLY using jQuery, so that the end result for this.className is just "top".
It is simply:
$(this).removeClass('currentMenu')
Reference: .removeClass
In plain JavaScript you can do something like:
function removeClass(node, cls) {
if(node && node.className && node.className.indexOf(cls) >= 0) {
var pattern = new RegExp('\\s*' + cls + '\\s*');
node.className = node.className.replace(pattern, ' ');
}
}
Or I don't understand your problem :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With