Skip to content

Instantly share code, notes, and snippets.

@aliahmadcse
Last active September 24, 2020 12:37
Show Gist options
  • Save aliahmadcse/f86ac6b0e64c154d07e32b0837bd4924 to your computer and use it in GitHub Desktop.
Save aliahmadcse/f86ac6b0e64c154d07e32b0837bd4924 to your computer and use it in GitHub Desktop.
UETIANS, We all know, how frustrating is it to fill course survey for each subject and marking those dumb radio buttons. So I have written this short script πŸ˜ƒ to automate this process. On your survey question air page, open developer tools (ctrl+shift+I) and then JS console and copy paste this script into console and hit enter. And that's it, al…
// for random selection of radio buttons
const radioContainers = document.querySelectorAll(".js_radio");
radioContainers.forEach((container) => {
const radioInputs = container.querySelectorAll("input");
const index = Math.round(Math.random() * 4);
radioInputs[index].checked = true;
});
window.scrollTo(0, document.body.scrollHeight);
@aliahmadcse
Copy link
Author

//for all 3 star ratings

const radioContainers = document.querySelectorAll(".js_radio");

radioContainers.forEach((container) => {
    const radioInputs = container.querySelectorAll("input");
    radioInputs[2].checked = true;
});

window.scrollTo(0, document.body.scrollHeight);

@aliahmadcse
Copy link
Author

//for all 2 star ratings

const radioContainers = document.querySelectorAll(".js_radio");

radioContainers.forEach((container) => {
    const radioInputs = container.querySelectorAll("input");
    radioInputs[3].checked = true;
});

window.scrollTo(0, document.body.scrollHeight);

@aliahmadcse
Copy link
Author

//for all 1-star ratings, if you are this much desperate

const radioContainers = document.querySelectorAll(".js_radio");

radioContainers.forEach((container) => {
    const radioInputs = container.querySelectorAll("input");
    radioInputs[4].checked = true;
});

window.scrollTo(0, document.body.scrollHeight);

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