selectors : single selector and multi selectors
single selector:
document.getElementById
let a=document.getElementById('div1');
console.log(a);
let element=a.className;
console.log(element);
a.innerHTML='what is your'
a.style.backgroundColor = "red";
a.innerHTML='<b>click here</b>'
multiple selector: Select multiple query or class using
1. getElementsByClassName
let elems=document.getElementsByClassName('div1')
Array.from(elems).forEach(function(argument){
console.log(argument);
argument.style.backgroundColor = "red";
argument.style.color = "white";
})
Comments
Post a Comment