madmanlear/Vanilla-js
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
This is a small class for replicating the most often-used (by me, at least) jQuery functionality in 2kb. Examples in the index.html file.
NOT READY FOR USE IN DEVELOPMENT
Includes:
* Find elements
* Create element
* Update attributes for element
* Iterate through elements with callback
* Bind events with callback
* Empty children from element
* Load script
* Get and set text from element
* Doc Ready
Other useful shortcuts build into js:
parent = element.parentNode
clone = element.cloneNode(true)
next = element.nextSibling
html = element.innerHTML
addClass = element.classList.add("foo")
removeClass = element.classList.remove("foo")
toggleClass = element.classList.toggle("foo")
attr = element.getAttribute("foo")