Last active
April 21, 2024 12:25
-
-
Save YazeedAlKhalaf/75e57f313fcc872adda309378c419d65 to your computer and use it in GitHub Desktop.
edugate auto rate
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
(function () { | |
let feedbackType = "r"; // Change to 'l' for left side, since sometimes negative and positive are switched :) | |
let rows = Array.from(document.querySelectorAll("table tr")); | |
rows.forEach((row) => { | |
let radios = Array.from(row.querySelectorAll('input[type="radio"]')); | |
if (radios.length > 0) { | |
let selection; | |
if (feedbackType === "r") { | |
selection = radios.slice(-3); | |
} else { | |
selection = radios.slice(0, 2); | |
} | |
let chosenOption = | |
selection[Math.floor(Math.random() * selection.length)]; | |
chosenOption.checked = true; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment