Hi, I have difficulty to make my function work in module.html(html + hubl). I have external javascipt file and I added the js file to using Linked Files.
I am in my module.html (footer), I want to use my function.
I think the problem is in your code. I simplified and code and recommend do this inside module first.
module.html
<p class="mb-24 md:mb-0 font-display text-16 md:float-left text-paper text-opacity-50"><span class="time"></span> All Rights Reserved.</p>
module.js
document.querySelector(".time").innerHTML = new Date().getFullYear();
The code above explained I’ve created a scripted that would set the current year then append that value to the span tag with a classname.
The reason why your code doesn’t work is because you need to save your function as a variable and pass it to the HTML, remember, JS is all about client side, so it won’t render as is. If this is a backend language, then it will all makes sense.