Last active
June 11, 2019 05:50
-
-
Save ashkantaravati/59e2f0d1ed6536bb44c19580e414efe3 to your computer and use it in GitHub Desktop.
I was too lazy and tired to answer all the professor survey questions so I wrote this!
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
var matches = [].slice.call(document.querySelectorAll('[id^=DropDownList]'));//Gets all dropdown selectors in an array | |
for (var i=0;i<matches.length;i++){//iterate through dropdownlists | |
//** random number generator part | |
var min = Math.ceil(2); | |
var max = Math.floor(6); | |
var randscore=Math.floor(Math.random() * (max - min)) + min; | |
//** random number generator part ends | |
matches[i].selectedIndex=randscore.toString();// set scores | |
}//we're done |
Dude ishalaw aroosit ❤️
var matches = [].slice.call(document.querySelectorAll('[id^=DropDownList]'));//Gets all dropdown selectors in an array
for (var i=0;i<matches.length;i++){//iterate through dropdownlists
//** random number generator part
var min = Math.ceil(1);
var max = Math.floor(5);
var randscore=Math.floor(Math.random() * (max - min)) + min;
//** random number generator part ends
matches[i].selectedIndex=randscore.toString();// set scores
}//we're done
To answer all questions
Copy the updated above code
Changes:
- change min from
2
to1
- and max from
6
to5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just works on a single page using console.
it could be better if it could iterate through surveys, set answers, submit and voila!
Please Contribute ^_^