For example, if we have btn 1 and btn 2.
Is it possible (with the onclick event) to click on btn 1, and then btn 2 appears?
Yes .
Any element, including button
elements, can have events set which trigger styling properties of other elements to change.
An Example:
let get = document.querySelector.bind(document), btn1 = get("#btn1"), btn2 = get("#btn2"); btn1.addEventListener("click", function() { btn2.style.display = "initial"; });
.hidden { display: none; }
<button id="btn1">Click Me</button> <button id="btn2" class="hidden" >I'm a button</button>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.