Here you can find the source of removeClass(className)
Element.prototype.removeClass=function(className){ var classNames=this.className.split(' '), newClass=''; for(var i=0;i<classNames.length;i++){ if(classNames[i]!==className){ newClass+=' '+classNames[i]; }/*from w w w .jav a 2 s .c o m*/ } // update the className return !!(this.className=newClass.trim()); };
Element.prototype.removeClass = function(className) { const regex = new RegExp(className, 'g') const newClasses = this.className.replace(regex, '') this.className = newClasses.trim() return this
Element.prototype.removeClass = function(className){ this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1'); return this;
Element.prototype.removeClass = function(cls) { if (this.hasClass(cls)) { var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)'); this.className=this.className.replace(reg,' '); };
Element.prototype.removeStyleClass = function(className) { if (this.className === className) { this.className = ""; return; var regex = new RegExp("(^|\\s+)" + className.escapeForRegExp() + "($|\\s+)"); if (regex.test(this.className)) this.className = this.className.replace(regex, " "); }; ...