Coding Global Background
Coding Global

'alert' function not working

Archived 3 years ago
4 messages
2 members
3 years ago
Open in Discord
L
ignite
Verified

```html <DOCTYPE html> <html lang="en"> <title>Hello</title> <script> document.addEventListener('DOMContentLoaded', function() { document.querySelector('form').addEventListener('submit') = function() { const name = document.querySelecter('#name').value; alert(`Hello, ${name}!`); }; }); </script> </html> <body> <h1>Hello!</h1> <form> <input autofocus id="name" placeholder="Name" type="text"> <input type="submit"> </form> </body> </DOCTYPE> ```

Replies (4)