Created
June 25, 2020 16:44
-
-
Save tgmarinho/c5cbc09f18e99f65d791e842f61b8b65 to your computer and use it in GitHub Desktop.
manipulando a dom
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
// document.getElementById("id") | |
let divContainerPiano = document.getElementById("piano-container"); | |
console.log(divContainerPiano); | |
// document.getElementsByTagName("tagName") | |
let allLiTag = document.getElementsByTagName("li"); | |
console.log(allLiTag); | |
// // document.createElement("name") | |
const newH1 = document.createElement("h1"); | |
newH1.textContent = "Olá, Teclado!"; | |
newH1.style.color = "#FFF"; | |
newH1.style.textAlign = "center"; | |
const divPiano = document.getElementById("piano"); | |
const divPianoContainer = document.getElementById("piano-container"); | |
divPiano.insertBefore(newH1, divPianoContainer); | |
// document.querySelector("seletor css") | |
const head = document.querySelector("head"); | |
console.log(head); | |
const divPiano = document.querySelector("#piano"); | |
console.log(divPiano); | |
const audios = document.querySelector(".audios"); | |
console.log(audios); | |
const noExist = document.querySelector("noExist"); | |
console.log(noExist); // undefined | |
// document.querySelectorAll(seletor css) | |
const allLis = document.querySelectorAll("li"); | |
console.log(allLis); | |
const divsWithClassWhite = document.querySelectorAll(".white"); | |
console.log(divsWithClassWhite); | |
const noExists = document.querySelectorAll("noExists"); | |
console.log(noExists); // NodeList [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment