javascript update copyright year code example
Example 1: javascript code for year in html
<script type="text/javascript">
document.write(new Date().getFullYear());
</script>
Example 2: javascript display year copyright
<script>document.write(new Date().getFullYear())</script>
Example 3: auto update copyright year javascript
<div class="copyright">
<footer>Copyright © <span id="year"></span> , All rights reserved to X</footer>
</div>
<script>
function getCurrentYear() {
return new Date().getFullYear();
};
document.getElementById("year").innerHTML = getCurrentYear();
</script>