Skip to content

Instantly share code, notes, and snippets.

@johnkpaul
Created January 10, 2012 16:38
Show Gist options
  • Save johnkpaul/1589927 to your computer and use it in GitHub Desktop.
Save johnkpaul/1589927 to your computer and use it in GitHub Desktop.
Add elements to bizodo select boxes programatically
var options_to_add = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"20+"];
var event = document.createEvent("MouseEvents");
event.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
for(var i=0,len=options_to_add.length;i<len;i++){
$$(".option_add")[0].dispatchEvent(event)
var empty_element = $$(".option_editor_row").filter(function(el){return el.firstChild.value == ""})[0];
empty_element.firstChild.value = options_to_add[i];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment