Skip to content

Instantly share code, notes, and snippets.

@mralfarrakhan
Last active December 31, 2023 07:45
Show Gist options
  • Select an option

  • Save mralfarrakhan/cef74d866fc1eec188bd3402f0ac4bdd to your computer and use it in GitHub Desktop.

Select an option

Save mralfarrakhan/cef74d866fc1eec188bd3402f0ac4bdd to your computer and use it in GitHub Desktop.
EDOM auto-fill
(() => {
let radios = document.querySelectorAll('input[type=radio]');
for(let i = 0; i < radios.length; i++){
if(radios[i].getAttribute('value') == `${Math.floor(Math.random() * 2) + 4}`){ //randomly generate value 4-6
radios[i].checked = true;
}
}
})()
@mralfarrakhan

Copy link
Copy Markdown
Author

Bare minimum, run a couple times to fill all radios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment