HTMLify
Create Button in Js
Views: 703 | Author: djdj
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <link rel="stylesheet" href=""> </head> <body> <button style="background-color:skyblue;"> Click me </button> <script> let btn = document.querySelector('button'); btn.addEventListener('click',showMsg); function showMsg(){ alert("Hello"); } </script> </body> </html> |