Made by Antonija withÂ
let paragraphs = document.getElementsByClassName("text-content");
// returns an array of all the elements with a class text-content
let mainHeading = document.getElementById("main-heading");
// returns a single object, a heading
let divs = document.getElementsByTagName("div");
// returns an array of all the div elements
let imageInArticle = document.querySelector("article > img");
// returns the first element that matches the query
let figures = document.getElementsByTagName("figure");
figures.remove()
let imageInArticle = document.querySelector("article > img");
imageInArticle.remove()
let p = document.createElement("p");
let contentOfP = document.createTextNode("I am nice paragraph");
div.appendChild(contentOfP);
header.appendChild(p)
let mainHeading = document.getElementById("main-heading");
mainHeading.innerHTML="Hello from the JS"
element.addEventListener("typeoflistener", function(){
// your code here
})
let mainHeading = document.getElementById("main-heading");
mainHeading.addEventListener("click", function(){
alert("Click")
});
let mainHeading = document.getElementById("main-heading");
mainHeading.addEventListener("mouseover", function(){
alert("Mouse over")
});