jQuery Plugin: addOption Get link Facebook X Pinterest Email Other Apps July 17, 2006 New plugin: addOption allows you to add items to a select dropdown list via jQuery. Get link Facebook X Pinterest Email Other Apps Comments Kevin Armstrong said… I tried using the code with Safari and the addOption method failed. I modified the code a little to work with Firefox, Safari, Opera and IE.Changed the following:var option = document.createElement("option");option.value = value;option.text = text;this.options.add(option);tovar option = document.createElement("option"); if($.browser.mozilla){ option.value = value; option.text = text; this.options.add(option);} else { this.add(option); option.innerText = text; option.value = value;} Sam said… The latest version works with Safari.
Comments
Changed the following:
var option = document.createElement("option");
option.value = value;
option.text = text;
this.options.add(option);
to
var option = document.createElement("option"); if($.browser.mozilla){
option.value = value;
option.text = text;
this.options.add(option);
} else {
this.add(option);
option.innerText = text;
option.value = value;
}