Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- function unCheckRadio(input){
- input.checked = false;
- input.removeAttribute('onclick');
- }
- function moveON(input){
- document.getElementsByName(input.name).forEach(radio => radio.removeAttribute('onclick'));
- input.setAttribute('onclick', 'unCheckRadio(this)');
- }
- </script>
- </head>
- <body>
- <div class="radioInputUncheckableGroup">
- <input type="radio" id='t' name='t'/>
- <input type="radio" id='t' name='t'/>
- <input type="radio" id='t' name='t'/>
- </div>
- <script>
- document.querySelectorAll('div.radioInputUncheckableGroup').forEach(div => {
- div.querySelectorAll('input[type=radio]').forEach(radio => radio.setAttribute('onchange', 'moveON(this)'));
- });
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment