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
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