Created
June 16, 2020 04:27
-
-
Save harrisonmalone/654e4bf01ccc88657b9d4dfd3c22540e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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