Why doesn't this javascript run more than once?

There is something that I dod not understand about javascript. The two "footer" statements below are identical. The first one prints a year in the copyright message. The second does not. It is as if the first one runs the javascript routine to get the year, but the second cannot. Some sort of reset is needed. What do I need to do in order to invoke the js more than once.

Thanks.

<footer id="Copyright" class="py-4 mb-4 bg-primary text-white text-center">
    Copyright&nbsp; © <span></span> Fred Software, Inc. All Rights Reserved.
</footer>

<footer id="Copyright2" class="py-4 mb-4 bg-primary text-white text-center">
    Copyright&nbsp; © <span></span> Fred Software, Inc. All Rights Reserved.
</footer>
<script src="{% static '/js/main.js' %}"></script>

where main.js consists of: const date = new Date(); document.querySelector('.year').innerHTML = date.getFullYear();

I'd recommend Stack Overflow for questions like this. The Help and How To forums here are for help with using the Bootstrap Studio program, not general programming or coding questions.

document.querySelector() will stop at the first occurrence. You would need to use document.querySelectorAll()

1 Like

@SureWeb: That was it. Thks. @Printninja: agreed.