On 10/14/06, dbzz <[EMAIL PROTECTED]> wrote:
> i ran into that 'options as html failure in ie' recently and found i could
> add them
> to a temp select, append that to the document, and then appendTo the
> original select.
> i imagine there's some nicer code to do this with, but here's what worked
> for me:
> (only tested in ie6 and ff1.5 on xp)
>
> $.fn.addoptionhtml = function(str){
> str = '<select id="tempselect">' + str + '</select>'
> $(this).append(str);
> $('#tempselect')[0] = new Option($(str).find('option'));
> $('#tempselect option').appendTo(this);
> $('#tempselect').remove();
> }
>
> $("#myselect").addoptionhtml('<option value="1">one</option><option
> value="2">two</option>')
Ahhh ... simplicity :) I'm going to test this out instead of my
horrendous string parsing method. Hopefully this will work out. Thanks
for sharing dbzz!
--
Brandon Aaron
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/