Coding Global Background
Coding Global
\n \n \n

Hello!

\n
\n \n \n
\n \n\n```","comment":[{"@type":"Comment","author":{"@type":"Person","name":"Muvels","url":"https://discord.com/users/705195199143608350","image":"https://cdn.discordapp.com/avatars/705195199143608350/d2b35aa2b67769da127e9819a38f503b.webp?size=1024"},"datePublished":"2023-04-25T17:43:44.259Z","text":"Hey 😄 , first of all i would suggest you to look in to the Chrome/Edge developer Tools, you cant get a alert message because the 'addEventListener' expects 2 Arguments"},{"@type":"Comment","author":{"@type":"Person","name":"Muvels","url":"https://discord.com/users/705195199143608350","image":"https://cdn.discordapp.com/avatars/705195199143608350/d2b35aa2b67769da127e9819a38f503b.webp?size=1024"},"datePublished":"2023-04-25T17:43:57.011Z","image":"https://cdn.discordapp.com/attachments/1100253569787101214/1100477312014757888/image.png?ex=699f34dd&is=699de35d&hm=403d9661058e42348ff99a1b3b1d7804ebdcbf0b5a807d94e0c906523baf741a&"},{"@type":"Comment","author":{"@type":"Person","name":"Muvels","url":"https://discord.com/users/705195199143608350","image":"https://cdn.discordapp.com/avatars/705195199143608350/d2b35aa2b67769da127e9819a38f503b.webp?size=1024"},"datePublished":"2023-04-25T17:47:03.786Z","text":"You could also simplify your Code like this:"},{"@type":"Comment","author":{"@type":"Person","name":"Muvels","url":"https://discord.com/users/705195199143608350","image":"https://cdn.discordapp.com/avatars/705195199143608350/d2b35aa2b67769da127e9819a38f503b.webp?size=1024"},"datePublished":"2023-04-25T17:49:59.131Z","text":"```\n \n Hello\n \n \n

Hello!

\n
\n \n \n
\n \n \n \n
```"}]}

'alert' function not working

Archived 3 years ago
4 messages
2 members
Created 3 years ago
Updated 3 years ago
Open in Discord
L
ignite
Verified
<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)