Created
July 7, 2021 09:03
-
-
Save ColonelMoutarde/2c7f54ecc139f9bbf2647414aeba755b to your computer and use it in GitHub Desktop.
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
/** Force number in input field of Organisator phone number */ | |
let textarea = document.getElementById('event_form_author_phone'); | |
textarea.addEventListener('keydown', (e) => { | |
console.log(e.key); | |
if (['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'Backspace'].indexOf(e.key) === -1) { | |
e.preventDefault(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment