Skip to content

Instantly share code, notes, and snippets.

@arunkumr
Created July 1, 2015 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arunkumr/46902270dab020be8907 to your computer and use it in GitHub Desktop.
Save arunkumr/46902270dab020be8907 to your computer and use it in GitHub Desktop.
Used to get all elements based on availability of attribute name.
function getAllElementsWithAttribute(d,parent) {
for (var c = [], b = parent.getElementsByTagName("*"), a = 0, e = b.length;a < e;a++) {
null !== b[a].getAttribute(d) && c.push(b[a]);
}
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment