Is this HTML/Js correct because it just rapidly asks if I want notifications instead of sending them after I click allow.

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notification System</title>
<script src="script.js" defer></script>
</head>
<body>
<button>click</button>
</body>
</html>

Js:

const button = document.querySelector("button")
button.addEventListener("click", () => {
Notification.requestPermission().then(perm =>{
if (perm === "granted") {
new Notification("Testing Testing 123", {
body: "bolls"
})
}
})
})

    put `` around the code i cant read this if it aint monospace
    needs to look like this

      ackvonhuelio I tried but something isn't working so it doesn't turn into monospace

      ackvonhuelio As you can see: the `` is at the end and beginning of the code but it wont turn into the code font style

        HTML:

        <!DOCTYPE html>
        <html lang="en">
        <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Notification System</title>
        <script src="script.js" defer></script>
        </head>
        <body>
        <button>click</button>
        </body>
        </html>

        Js:

        const button = document.querySelector("button")
        
        button.addEventListener("click", () => {
        Notification.requestPermission().then(perm =>{
        if (perm === "granted") {
        new Notification("Testing Testing 123", {
        body: "bolls"
        })
        }
        })
        })

          const button = document.querySelector("button")
          button.addEventListener("click", () => {
          Notification.requestPermission().then(perm =>{
          if (perm === "granted") {
          new Notification("Testing Testing 123", {
          body: "bolls"
          })
          }
          })
          })

          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Notification System</title>
          <script src="script.js" defer></script>
          </head>
          <body>
          <button>click</button>
          </body>
          </html>

          gZany Fixed it... there cant be a blank line

          like this.

          Ravage Saying that it didn't work for me isn't saying that another person is wrong.

          Chat