Nodejs Utililty Methods HTML Element Class Remove

List of utility methods to do HTML Element Class Remove

Description

The list of methods to do HTML Element Class Remove are organized into topic(s).

Method

removeClass(className)
Element.prototype.removeClass = function(className) {
  const regex = new RegExp(className, 'g')
  const newClasses = this.className.replace(regex, '')
  this.className = newClasses.trim()
  return this
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];
  return !!(this.className=newClass.trim());
...
removeClass(className)
Element.prototype.removeClass = function(className){
  this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');
  return this;
removeClass(cls)
Element.prototype.removeClass = function(cls) {
  if (this.hasClass(cls)) {
      var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
    this.className=this.className.replace(reg,' ');
};
removeStyleClass(className)
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, " ");
};
...