Hmm... It might be trivial, but that means I have to write code that
will decide if an option is selected or not rather than passing a boolean.
I used to be able to do this:
$("##Classification_ID").addOption("myValue", "myOptionDisplay",
(a[i].toUpperCase() == "RN"));
The last bit would evaluate to a true or false, and either select the
option or not. It's was a handy shortcut. Well, I'll overcome it.
Jörn: I was able to get a small sample to break, but since it appears
that what the dev folks want is for us to .append and .prepend, I'll do
that. Whatever is faster. :o)
Thanks Brandon.
Thanks Jörn.
Cheers,
Chris
Brandon Aaron wrote:
A plugin used to be necessary for something like this as IE had some
problems adding html to a select element. In jQuery we were able to
work around this and provide a way to add html to select elements. I
think it is better to not use a plugin if you don't have too. Less
code to push to the browser. You should be able to select and element
like this:
$('#select').append('<option value="" selected="selected">Name</option>');
You can also use .prepend().
--
Brandon Aaron
On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote:
Does everyone agree that this is the best way? I figured that the plug-in
was written for a reason. I picked it up early, before I knew very much
jQuery, and have just kept it in my code. I did notice that the plug-in
doesn't appear to be available from jQuery.com/plugins (but, then again
neither is the plug-in that I wrote).
So which way *should* I be trying to accomplish building my selects? One
nice feature of this plug-in is the ability to pass a true or false to
select the option or not.
Any more thoughts? (also, I'm still trying to produce an example showing
the break I'm seeing)
Chris
Brandon Aaron wrote:
As of 1.0.3 I believe you can do this with straight HTML across all
browsers.
$('#optionElm').append('<option value="">Name</option>');
--
Brandon Aaron
On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote:
Hi folks,
I'm using Sam Collett's plug-in to add and remove options from a select
list, and under jQuery 1.1a it breaks.
for(i = 0; i < ClientData.shifts.length; i++){
$("##Shift_ID").addOption(ClientData.shifts[i].shiftcode + "~" +
ClientData.shifts[i].shiftid + "~" + ClientData.shifts[i].shiftname,
ClientData.shifts[i].shiftname, false);
}
The above code used to work and now it doesn't. The specific error is
"object doesn't support this property or method".
Any ideas? Short enough, Jörn? ;o)
Chris
--
http://www.cjordan.info
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
http://www.cjordan.info
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
http://www.cjordan.info
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/