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/

Reply via email to