> $("#field1 & #field2").length would be either 0 or 2, but never 1.
How about a plugin? These are short enough they could be added to the
core.
$("#field1").and("#field2").length
// If elements are selected in this jQuery object,
// add sel to that; else empty the object.
jQuery.fn.and = function(sel){
return this.length? this.add(sel) : this.pushStack([]);
};
// If no elements are selected in this jQuery object, use
// the ones selected by sel; else use the current ones.
jQuery.fn.or = function(sel){
return this.pushStack( this.length? this : sel );
};
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---