Created
August 29, 2022 16:13
-
-
Save zooks/037da7ebf61a35448de8c539e7dcb6c9 to your computer and use it in GitHub Desktop.
Cleave.js apply to all elements with specific classname
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
window.onload = function () { | |
var datesCollection = document.getElementsByClassName("input-date"); | |
var dates = Array.from(datesCollection); | |
dates.forEach(function (date) { | |
new Cleave(date, { | |
date: true, | |
delimiter: '-', | |
datePattern: ['Y', 'm', 'd'] | |
}) | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment