Created
July 22, 2018 10:45
-
-
Save onkar-singh/7a1843824cd230f9af9bc5d7c726f713 to your computer and use it in GitHub Desktop.
JS Selectors
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
var X = document.getElementById("intro"); | |
var x = document.getElementsByTagName("p"); | |
var x = document.getElementsByClassName("intro"); | |
var x = document.querySelectorAll("p.intro"); | |
element.innerHTML = new html content // Exam:- object.innerHTML/.innerText/.textContent = "<p>Dog</p>"; | |
element.attribute = new value // Exam:- object.src = "landscape.jpg"; | |
element.style.property=newstyle // Exam:- object.style.color="blue"; | |
element.setAttribute(attribute, value) // Exam:- object.setAttribute("style", "background-color: red;"); | |
element.removeAttribute(attributename) // Exam:- object.removeAttribute("href"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment