Skip to content

Instantly share code, notes, and snippets.

@LeandroLuque
Created July 1, 2016 18:46
Show Gist options
  • Save LeandroLuque/5b85cd5895240ce94eb8badc482d0fd9 to your computer and use it in GitHub Desktop.
Save LeandroLuque/5b85cd5895240ce94eb8badc482d0fd9 to your computer and use it in GitHub Desktop.
Completa encuestas unpsjb facultad de ingenieria
/* DISCLAIMER:
It doesn't complete all select fields, just the ones where the options are:
"Malo" .. "Muy bueno y satisfatorio"
The final value for all the options is set to: "Muy bueno y satisfatorio"
Target: http://www.ing.unp.edu.ar/encuestas/
Authors: Luque Leandro, Pazos Bruno.
*/
var selects = document.querySelectorAll('select[name^=preg]');
for (var i = 0; i < selects.length; i++){
var opcion = selects[i].querySelectorAll('option')[4];
console.log(opcion);
if (opcion)
opcion.setAttribute('selected','selected')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment