topical media & game development

talk show tell print

#javascript-code-03-htmlelement.js / js



  // Add a new method to all HTML DOM Elements
  // that can be used to see if an Element has a specific class, or not.
  HTMLElement.prototype.hasClass = function( class ) {
      return new RegExp("(^|\\s)" + class + "(\\s|)").test( this.className );
  };
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.