JS Help 2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JS Help 2

How can I make a button when pressed make new buttons appear. (the new button are pre-made but invisible)

20th Dec 2017, 6:25 AM
JOHNTHEBUN
JOHNTHEBUN - avatar
5 Answers
+ 24
<html> <head> <title>JavaScript A-Z Practicals</title> <style> h1{ color:red; text-align:center; background:-webkit-linear-gradient(blue , cyan , #00F318 , cyan , blue); } button { color:red; font-weight:bolder; padding:10px; margin:10px 0 10px 30%; } pre{ color:#00F318; } </style> <script> function show_code() { x = document.getElementById("show_js_code"); if(x.style.display=="block"){ x.style.display="none"; } else{ x.style.display="block";} } </script> </head> <body bgcolor="black"> <h1>If & Else</h1> <button onclick="show_code()">Show Code</button> <br/> <pre id="show_js_code"> if( b_tags.style.display=="block"){ b_tags.style.display="none"; } else{<br/> b_tags.style.display="block";} </pre> </html> try this code 100% Working
20th Dec 2017, 6:38 AM
☆Sampath👻
☆Sampath👻 - avatar
+ 8
you can change the css with js yourButton.style.display = "block"; yourButton.style.display = "none";
20th Dec 2017, 6:31 AM
Kamil
Kamil - avatar
+ 6
<input type="button" value="click me" onclick="myFunction()" />
20th Dec 2017, 6:28 AM
GAWEN STEASY
GAWEN STEASY - avatar
- 1
im asking how can i make a button appear
20th Dec 2017, 8:12 AM
JOHNTHEBUN
JOHNTHEBUN - avatar