+ 2

How To Change CSS By Click Of An Element

I have one div and a button. I want for when I click on the button for the display type of the div to change from none to inline-block.

4th Jul 2017, 2:07 PM
Spoops
Spoops - avatar
5 odpowiedzi
+ 5
<div id="thediv">previously hidden content</div> <input type="button" value="click me!" onclick="document.getElementById('thediv').style.display='inline-block;';">
4th Jul 2017, 2:42 PM
visph
visph - avatar
+ 7
Change the value of document.getElementById("mydiv").style.display
4th Jul 2017, 2:31 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 3
Seriously? @Krishna answer is better? Nothing againt him/you, but next time I will spare time of explict answer with full code ;P (What made e react is that you've marked mine as best and modified it immediatly...)
4th Jul 2017, 3:48 PM
visph
visph - avatar
+ 1
I'm really sorry. Ive never asked a question before. I didn't realize you could mark only one.
4th Jul 2017, 3:56 PM
Spoops
Spoops - avatar
0
Thank you guys so much for the answers.
4th Jul 2017, 3:44 PM
Spoops
Spoops - avatar