Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get elements by class name wildcard

var elements = document.getElementsByClassName( /* class names other than aid_* ones */
var re = new RegExp('(^|s)aid_(s|$)'); 
var result = [];

for (var i=0, iLen=elements.length; i<iLen; i++) {
  if (re.test(elements[i].className)) {
    result.push(elements[i]);
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #elements #class #wildcard
ADD COMMENT
Topic
Name
5+8 =