Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

How to update an element using .textContent

$
0
0

I want to use a script using JavaScript that updates an element in the footer of a website. However, the h3 element isn't getting updated.

I have tried textContent not updating HTML, but I wasn't able to find my solution there.

Here is my CodePen: https://codepen.io/martinlutherwinn/pen/NWPvRpZ

This is my current code:

<div class="Footer">
    <h3></h3>
</div>
var copyrightedYear = (function() {
    var header = document.getElementsByClassName("Footer")[0].textContent;
    var currentDate = new Date();
    var currentYear = currentDate.getFullYear();
    var msg = "@" + currentYear + " Haitian Educators of Palm Beach.";
    header = msg;
}());

Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>