Modify ↓
Ticket #889 (closed feature: wontfix)
split jquery chain in two parts for matching / not matching conditions
| Reported by: | tex@… | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | core | Version: | |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description (last modified by joern) (diff)
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
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.
