Skip to content

Instantly share code, notes, and snippets.

@masnormen
Created March 12, 2022 07:39
Show Gist options
  • Save masnormen/fec19fc80b92c04219772ff00b16020e to your computer and use it in GitHub Desktop.
Save masnormen/fec19fc80b92c04219772ff00b16020e to your computer and use it in GitHub Desktop.
Survey Kesehatan Autofill Script
// © 2022 Nourman Hajar
// Menjawab survey kesehatan SIAM UB dengan jawaban sehat
// Note: Kalau sakit jangan pakai ini y
const result = document.evaluate("//tr[@class='text' and not(@id) and descendant::input[@type='radio']]", document, null, XPathResult.ANY_TYPE, null);
let node, nodes = []
while (node = result.iterateNext()) nodes.push(node);
for (let i = 0; i < nodes.length; i++) {
const checkboxes = nodes[i].querySelectorAll('input');
checkboxes[i == 1 ? 0 : 1].checked = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment