Modify ↓
Ticket #5550 (closed bug: invalid)
Selector option:gt(-1) doesn't work for Select fields
| Reported by: | caseol | Owned by: | john |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4 |
| Component: | selector | Version: | 1.3.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I was trying to empty all options of a select field doing:
$("#MySelectFieldId option:gt(-1)").remove();
Using jQuery 1.3.2 it doesn't work, but using 1.2.6 does.
So, I check the size of the array returned: $("#MySelectFieldId option:gt(-1)").size() and the result is 0 no matter the number of options inside the select field.
Hope it could help.
Regards
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This selector makes no sense. If you want to select everything, omit the :gt.