-
-
Save matherton/c7079f29a55e8ea59da5db7746f7ba27 to your computer and use it in GitHub Desktop.
ES6 function for un-selectable radio buttons
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
radioChecked = () => { | |
var allRadios = document.querySelectorAll('input[type="radio"]'); | |
allRadios.forEach(r => { | |
r.addEventListener('mouseup', function(e) { | |
if (r.checked) { | |
setTimeout(() => { | |
r.checked = false; | |
}, 0); | |
} | |
}); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment