+ 1

How to create a button using JavaScript any JavaScript alone

Please someone to explain.

21st Aug 2021, 6:36 AM
ELISHA
2 Answers
21st Aug 2021, 6:43 AM
Ipang
+ 1
onload=()=>{ let button =document.createElement('button'); button.textContent='button'; document.body.appendChild(button); button.onclick=()=>{alert("pressed")} }
21st Aug 2021, 6:46 AM
SAN
SAN - avatar