[jQuery] Re: Select Length Reference

2007-05-08 Thread Dan G. Switzer, II
Jeff, >> // remove selected items from the #mySelect element >> var oRemoved = $("option:selected", oSelect).remove(); >> >> -- or -- >> >> var oRemoved = oSelect.find("option:selected").remove(); >> > >How would you identify an individual option index using this syntax? >In other words if I want

[jQuery] Re: Select Length Reference

2007-05-08 Thread Jeff Fleitz
> // remove selected items from the #mySelect element > var oRemoved = $("option:selected", oSelect).remove(); > > -- or -- > > var oRemoved = oSelect.find("option:selected").remove(); > How would you identify an individual option index using this syntax? In other words if I wanted to check the v

[jQuery] Re: Select Length Reference

2007-05-07 Thread Jeff Fleitz
> Now for Part 2 of the lesson. :) > > // remove selected items from the #mySelect element > var oRemoved = $("option:selected", oSelect).remove(); > That's the ticket! I had just finished caching the #mySelect reference like that, and was just trying to figure out how to make that call, but cou

[jQuery] Re: Select Length Reference

2007-05-07 Thread Dan G. Switzer, II
Jeff, >> First off, always try to cache jQuery objects if you're planning on >reusing >> them. This speed things up considerably, as jQuery doesn't have to keep >> doing the parsing. > >Good point. > > >> With all that said, you should be able what you're wanting in one >command: >> >> var oRemov

[jQuery] Re: Select Length Reference

2007-05-07 Thread Jeff Fleitz
> > First off, always try to cache jQuery objects if you're planning on reusing > them. This speed things up considerably, as jQuery doesn't have to keep > doing the parsing. > Good point. > With all that said, you should be able what you're wanting in one command: > > var oRemoved = $("#mySele

[jQuery] Re: Select Length Reference

2007-05-07 Thread Dan G. Switzer, II
Jeff, >for (i = $("#mySelect")[0].length - 1; i>=0; i--) { > if ($("#mySelect option:selected")[i]) { >$("#mySelect").removeOption(i); > } >} First off, always try to cache jQuery objects if you're planning on reusing them. This speed things up considerably, as jQuery doesn't have to keep

[jQuery] Re: Select Length Reference

2007-05-07 Thread Jeff Fleitz
Hey Dan, > Personally, I'd use $("#mySelect")[0].length, since it uses the actual DOM > property for the element. This should be faster than parsing out > the option tags that are selected. > Yep, I like that as well. > However, the $("#mySelect option:selected") would allow you do other thing

[jQuery] Re: Select Length Reference

2007-05-07 Thread Jeff Fleitz
Worked, thanks Dennis. On May 7, 11:15 am, spinnach <[EMAIL PROTECTED]> wrote: > try $("#mySelect")[0].length ... >

[jQuery] Re: Select Length Reference

2007-05-07 Thread Dan G. Switzer, II
Jeff, >I apologize in advance if this is in the docs, but I probably won't be >able to access the jQuery site for a while now that the ip has >changed, due to proxy issues. > >I want to limit a user from entering more than a specified number of >options, and can't find the correct syntax (or mayb

[jQuery] Re: Select Length Reference

2007-05-07 Thread spinnach
try $("#mySelect")[0].length ... dennis. Jeff Fleitz wrote: I apologize in advance if this is in the docs, but I probably won't be able to access the jQuery site for a while now that the ip has changed, due to proxy issues. I want to limit a user from entering more than a specified number of