Script not working in pug express node

Previously, i have a hard time flashing message and fading after some time. I now succeeded with DOM. My major problem now is to put the DOM file on the pug head to work like regular html. I tried that and its not working please help thank you.
//pug

DOCTYPE 
html(lang="eng")
  head
    title Home Page
    meta(name='description', content='Preparing Personal Portfolio')
    meta(charset='utf-8')
    meta(http-equiv='X-UA-Compatible', content='IE=edge')
    meta(name='viewport', content='width=device-width, initial-scale=1')
    script(src="./my-script.js")
  header
    h1
     small nanas personal portfolio looksup for presentation
    h2.center#welcome Welcome, #{username}!
  body
    a(href="/register") register
    br
    a(href="/login") login 

//script.js

document.addEventListener('DOMContentLoaded', function() {
 
  // this function runs when the DOM is ready, i.e. when the document has been parsed
  var sellct = document.querySelector('h2');
  sellct.textContent =
  'registered succesful!'

  setTimeout(function() {
    sellct.remove();
  }, 1500); 
});

link: Glitch

well now here’s something suspicious

script(src="./my-script.js")

//script.js

I suggest you not fix this yet and take some time to examine your tools, such as the browser console, to see if you can find any hints that would have led you to this discrepancy.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.