Bug Tracker

Opened 14 years ago

Closed 12 years ago

#3244 closed feature (invalid)

small 'else-like' function: "instead" or "others"

Reported by: oliverlangan Owned by: flesler
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc: oliverlangan
Blocked by: Blocking:


From the mailing lists: http://tinyurl.com/5ru4fl http://tinyurl.com/5kev5r

This function allows you to write else-like statements in jQuery chains, immediately ending a previous destructive operation and filtering to everything else that had not been previously matched.

jQuery.fn.instead = function() {

return this.end().not(this);


A good name would have been 'else' but as a reserved word that causes some problems. Other suggested names have been "instead", "others", "otherwise", "invert", or "inverse".

Change History (4)

comment:1 Changed 14 years ago by oliverlangan

One possible extension to this code would be the ability to pass in an additional selector, creating more of an if-elseif-else structure: however, I could not see a way to filter out both the first ('if') and subsequent (elseif) sets from the final ('else') set.

comment:2 Changed 14 years ago by flesler

Cc: oliverlangan added
Owner: set to flesler
Status: newassigned

comment:3 Changed 14 years ago by flesler

need: ReviewTest Case

Can you provide 2-3 simple situations where this is really useful ?

comment:4 Changed 12 years ago by dmethvin

Resolution: invalid
Status: assignedclosed

Rather than leave this ticket open, perhaps someone can create a plugin and show its usefulness that way.

Note: See TracTickets for help on using tickets.