Last active
July 20, 2020 15:43
-
-
Save thet/4171d3f7f5b075d7360c0927c9ffb353 to your computer and use it in GitHub Desktop.
input type date validity test
This file contains 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
let form = document.createElement('form'); | |
let el = document.createElement('input'); | |
el.setAttribute('type', 'date'); | |
el.setAttribute('name', 'okay'); | |
form.appendChild(el); | |
document.body.appendChild(form); | |
let input = document.querySelector('form input'); | |
input.value = 'lsk'; | |
console.log(input.validity.valid); // says ``true``, should be ``false`` | |
console.log(input.validity.badInput); // says ``false``, should be ``true`` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment