Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Created June 16, 2020 04:27
Show Gist options
  • Save harrisonmalone/654e4bf01ccc88657b9d4dfd3c22540e to your computer and use it in GitHub Desktop.
Save harrisonmalone/654e4bf01ccc88657b9d4dfd3c22540e to your computer and use it in GitHub Desktop.
// DOM
// special document variable
// object
// you can access it in client side js
// selector functions
// querySelector
// querySelectorAll
// const h1 = document.getElementsByTagName("h1")[0]
// creating element functions
// createElement
// insertAdjacentHTML
// insertAdjacentElement
// h1.insertAdjacentHTML("afterend", "<h2>hello world</h2>")
// removing elements
// element.removeChild()
// changing CSS
// adding, toggling and removing classes
// .add
// .remove
// .toggle
// .style
// h1.style
// events
// => arguments, string name of the event, a callback function
// const form = document.querySelector("form")
// form.addEventListener("submit", (event) => {
// event.preventDefault()
// const name = event.target[0].value
// // send this data to an api OR to a web server
// // fetch
// })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment