getElementsByClassName: Simple Shorthand Way to Get HTML Element by className with RegExp

A simple JavaScript function to give web developers, web coders, web programmers ability for get HTML elements by their className properties.


Sampled by © JavaScriptBank.com

Some ways to call it:

To get all a elements in the document with a "info-links" class:
getElementsByClassName(document, "a", "info-links");

To get all div elements within the element named "container", with a "col" class:
getElementsByClassName(document.getElementById("container"), "div", "col");

To get all elements within in the document with a "click-me" class:
getElementsByClassName(document, "*", "click-me");


2000+ free JavaScripts
at www.JavaScriptBank.com