+ 2
How To make onclick css
Hello everybody. I Need help. How make onclick event on css. Situation: I made hidden div And another div named "button" I want make : if I Will click on button, hidden div after clicking change his property to visible
3 odpowiedzi
+ 5
It is actually not possible with only CSS.
https://stackoverflow.com/questions/13630229/can-i-have-an-onclick-effect-in-css
But with help of JavaScript or jQuery, you can surely do that.
code is given by Игорь Яковенко
In css you can use active property, but it is not exactly onclick.
https://www.w3schools.com/cssref/sel_active.asp
+ 3
You could use only css pseudo element :target to achieve it.
https://code.sololearn.com/WZC8i1RxoeOH/?ref=app
0
HTML:
<div id="div1"> .... </div>
<div onclick=f()> .... </div>
JS:
function f(){
document.getElementById("div1").style.property=value;
}
"property" - the name of the property, "value" - the value of the property