jQuery Plugin: addOption

New plugin: addOption allows you to add items to a select dropdown list via jQuery.

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);

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;
}
Sam said…
The latest version works with Safari.

Popular posts from this blog

Select box manipulation with jQuery

iTextSharp: Generating a Basic PDF file (ASP.NET/C#)

Popup Window Countdown (JavaScript)