Skip to main content

Bug Tracker

Side navigation

#3244 closed feature (invalid)

Opened August 11, 2008 03:46PM UTC

Closed October 03, 2010 03:13AM UTC

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:

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".

Attachments (0)
Change History (4)

Changed August 11, 2008 03:48PM UTC by oliverlangan comment:1

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.

Changed August 11, 2008 03:55PM UTC by flesler comment:2

cc: → oliverlangan
owner: → flesler
status: newassigned

Changed August 12, 2008 05:48PM UTC by flesler comment:3

need: ReviewTest Case

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

Changed October 03, 2010 03:13AM UTC by dmethvin comment:4

resolution: → invalid
status: assignedclosed

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