×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Matthew Speicher
Added: Jun 22, 2016 5:39 PM
Modified: Jun 22, 2016 5:39 PM
Views: 5
Tags: no tags
  1. HTMLElement.prototype.removeClass = function(remove) {
  2.             var newClassName = "";
  3.             var i;
  4.             var classes = this.className.split(" ");
  5.             for(i = 0; i < classes.length; i++) {
  6.                 if(classes[i] !== remove) {
  7.                     newClassName += classes[i] + " ";
  8.                 }
  9.             }
  10.             this.className = newClassName;
  11. }