-
Notifications
You must be signed in to change notification settings - Fork 24
03. Get Elements by Class Name (dgCN.js)
Pimp Trizkit edited this page Mar 6, 2018
·
1 revision
<< Previous | Back to Table of Contents | Next >> |
"You Gotta Have Class." - PT
This is just an alias function to shorten other JS code.
"dgCN" alias for "document.getElementsByClassName".
This will search inside document
for elements that have a className
equal to the string specified. And then return a HTML Collection of those elements.
const dgCN=(c)=>document.getElementsByClassName(c);
let hc = dgCN("myClassName");
A HTML Collection of HTML Elements, from inside document
, that have className
equal to the parameter specified. NOTE: If no such elements exists, the collection will be empty.
dgCN(c)
c = < ClassName String > * REQUIRED
- A string to search in
document
for elements of the same className. - This function uses
document.getElementsByClassName()
, and is just an alias.
"Programming comfortably with my PJs." - PT