Thanks!
But this dosn't work in IE:
$('ddArtists').adopt(new Option(itm.Text, itm.Value));
From: [email protected]
[mailto:[email protected]] On Behalf Of Thierry bela nanga
Sent: Friday, February 26, 2010 11:42 AM
To: [email protected]
Subject: Re: [Moo] Removing items from a select box
select.empty(); //remove all options
select.adopt(new Option(itm.Text, itm.Value)) //add an option
On Fri, Feb 26, 2010 at 5:33 PM, hazlema <[email protected]> wrote:
Is there a mooish way to remove all items from a select?
This is what I have while it works its not very elegant
Element.implement({
removeOptions: function () {
for (var count = this.options.length - 1; count >= 0; count--)
{
this.removeChild(this.options[count]);
}
}
});
Same problem with adding:
data.each(function (itm) {
try {
$('ddArtists').add(new Option(itm.Text, itm.Value),
null); // Everything else
}
catch (ex) {
$('ddArtists').add(new Option(itm.Text, itm.Value)); //
IE (Maybe others)
}
});
}
--
http://tbela99.blogspot.com/
fax : (+33) 08 26 51 94 51