On 11/10/06, Sam Collett <[EMAIL PROTECTED]> wrote:
On 11/10/06, Blair McKenzie <[EMAIL PROTECTED]> wrote:
I dug this plugin up from the mail list. Don't know whether it's up to date though.

Blair

That is an old version. I have a newer version available at:
http://www.texotela.co.uk/code/jquery/select/

To add multiple options:

var myOptions = {
    "Value 1" : "Text 1",
    "Value 2" : "Text 2",
    "Value 3" : "Text 3"
}
$("#myselect2").addOption(myOptions, false); // use true if you want to select the added options

If you already have an array that can't be changed (generated from someone elses script), you could always loop through it to populate 'myOptions':

var ar = [];
ar["Value 1"] = "Text 1";
ar["Value 2"] = "Text 2";
ar["Value 3"] = "Text 3";

var myOptions = {};

for (var i in ar)
{
    myOptions[i] = ar[i];
}
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to