+ 3
you can do this with if else statements in javascript.
el.on(âclickâ, () => {
if (el.style.display === ânoneâ)
el.style.display = âblockâ;
else
el.style.display = ânoneâ;
});
+ 2
In a div create h1 (heading) and a p (for message).
Now create a new class in css
.classname{
display :none; only
}
On h1 add a click event function
In fxn access p let's var para
Then
Para.classList.toggle("classname") ;
Hope it will work
+ 2
đđ
+ 1
Brian R if el is display none how one can click on it to make it display block???
Your click event is on the same element.
does it work??