Last active
December 8, 2017 14:00
-
-
Save che-wf/9bbd25b278c73cd76f2c to your computer and use it in GitHub Desktop.
Add Copyright Year to Your Site Properly Using JavaScript/jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <small> | |
| ©<span id="copyright"></span> Some Company, LLC | |
| </small> | |
| <script> | |
| (function () { | |
| const startYear = 2017, | |
| currYear = new Date().getFullYear(); | |
| const year = currYear > startYear ? | |
| `${startYear}-${currYear}` : startYear; | |
| //JavaScript | |
| document.getElementById('copyright').innerHTML = year; | |
| ////jQuery | |
| //$('#copyright').html(year); | |
| })(); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment