Skip to content

Instantly share code, notes, and snippets.

@gbradley
Last active December 18, 2015 09:19
Show Gist options
  • Select an option

  • Save gbradley/5760102 to your computer and use it in GitHub Desktop.

Select an option

Save gbradley/5760102 to your computer and use it in GitHub Desktop.
Probably the quickest way you're gonna be able to do this...
var divs = document.querySelectorAll ? document.querySelectorAll('div[id^=csc]') : (function(){
var divs = (document.getElementById('commonAncestorElementIdGoesHere') || document).getElementsByTagName('div'),
i = divs.length,
result = [],
div;
while (i--){
div = divs[i];
if (div.id && div.id.match(/^csc/)){
result.push(div);
}
}
return result;
})();
console.log(divs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment