+ 2

How to make a button appear when another button is pressed?

For instance I want to make a button x And when I click on the button x, I want a button y to appear Can someone help me please đŸ˜¶

21st Dec 2017, 4:31 PM
Clarke
Clarke  - avatar
2 Answers
+ 4
<!--Use it please ↓↓↓ :)--> <div id ="beta" onclick="B()">some content</div> <script> function B() { var p = document.createElement("button"); var node = document.createTextNode("Click me Please"); p.appendChild(node); var div = document.getElementById("beta"); div.appendChild(p); } </script>
21st Dec 2017, 4:35 PM
James16
James16 - avatar
+ 2
Thank you James16 Could you possibly explain please? It would be very appreciated đŸ˜ŠđŸ˜¶ And how do you stop it from making more than one button
21st Dec 2017, 5:41 PM
Clarke
Clarke  - avatar