How To make onclick css | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 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

2nd Jan 2019, 9:25 AM
Daniil Timonov
Daniil Timonov - avatar
3 Respostas
+ 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
2nd Jan 2019, 9:44 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 3
You could use only css pseudo element :target to achieve it. https://code.sololearn.com/WZC8i1RxoeOH/?ref=app
2nd Jan 2019, 10:07 AM
Calvi’≤
Calvi’≤ - avatar
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
2nd Jan 2019, 9:46 AM
–ė–≥–ĺ—Ä—Ć –Į–ļ–ĺ–≤–Ķ–Ĺ–ļ–ĺ
–ė–≥–ĺ—Ä—Ć –Į–ļ–ĺ–≤–Ķ–Ĺ–ļ–ĺ - avatar