Insert current year into any HTML element by CDN script
- Works instantly via CDN <script> tag
- Config through
data-get-year
attribute - Supports default
.current-year
class
<span class="current-year"></span>
<script src="https://cdn.jsdelivr.net/npm/get-year"></script>
<div data-get-year=".footer-year"></div>
Parameters:
data-get-year="[selector]"
- Optional parameter: CSS selector to target other elements
- If empty, updates the element itself
<!DOCTYPE html>
<html>
<head>
<title>Get Year Example</title>
<script src="https://cdn.jsdelivr.net/npm/get-year"></script>
</head>
<body>
<!-- Basic usage -->
Copyright © <span class="current-year"></span>
</body>
</html>
MIT License
Contributions welcome! Feel free to:
- Fork the repository
- Submit pull requests
- File issues
- Suggest improvements