Opened 16 years ago
Closed 16 years ago
#889 closed feature (wontfix)
split jquery chain in two parts for matching / not matching conditions
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | core | Version: | |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
There are cases where you want to affect two sets of elements, matching and not matching. here is an example:
<label><input type='radio' name='onOff' value='on'></input>on</label> <label><input type='radio' name='onOff' value='off'></input>off</label>
calling function either, for lack of a better name. This corresponds to ? : syntax, is there a name for that?
$('#onOff').either( '[value=on]', function() { // this should be passed to each() this.checked = true; alert( 'checking ' + this.name ); }, function() { this.checked = false; } );
Anyway, if this sounds interesting to anyone else I'd be happy to send code, or maybe add it as a plugin. I find myself using this pattern fairly regularly, so.. thought it was worth a request.
Change History (2)
comment:1 Changed 16 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 16 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
This was brought up before, in the form of an if/else plugin. We opted not to include. However, I'm sure having a simple .either() plugin would be very useful to a number of people.