What I would do is just create Option object, it would do the append
automatically.
[code untested]
var routeSelect = $("#routeSelect").get(0);
routeSelect.options.length = 0; //reset to zero length
for(var i = 0; i < routes.length; ++i) {
routeSelect.options[i] = new Option(routes[i],routes[i]);
}
On 10/11/06, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
>
> Sean O schrieb:
> > Galen,
> >
> >
> > This may be of little help, but might get you pointed in the right
> > direction...
> > The following code works in FF 1.5.0.7 (PC):
> >
> > // dummy data
> > var routes=new Array();
> > routes[0]="Zero";
> > routes[1]="One";
> > routes[2]="Two";
> >
> > var options="";
> > for(i = 0; i < routes.length; ++i) {
> > options += ' <option value="' + routes[i] + '">' + routes[i]
> > +
> > '</option>\r\n';
> > }
> > options += "</select>";
> > $("#routeselect").html(options);
> >
> > However, it bombs (empty <select>) in both IE6 and O9...
>
> In IE the innerHTML property for a select element is readonly, so forget
> about html() or append(<String>).
>
> You'll have to use the option constructor or document.createElement...
>
>
> -- Klaus
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
--
Best Regards,
Jacky
網絡暴民 http://jacky.seezone.net
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/