Skip to content

Instantly share code, notes, and snippets.

@iwill
Last active September 4, 2015 12:14
Show Gist options
  • Save iwill/320641 to your computer and use it in GitHub Desktop.
Save iwill/320641 to your computer and use it in GitHub Desktop.
$.fn.and
/*!
* jQuery plugin - jquery.and.js v1.1
* http://github.com/iwill/
*/
(function($) {
$.fn.and = function(selector, context) {
return $.merge(this.pushStack(this), $(selector, context));
};
})(jQuery);
@iwill
Copy link
Author

iwill commented Apr 9, 2013

var $all = $("#a");
$all.and("#b");
$all.and("#c");
// ====
var $all = $("#a");
$all = $all.add("#b");
$all = $all.add("#c");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment