Skip to content

Instantly share code, notes, and snippets.

@yeco
Created October 11, 2012 04:45
Show Gist options
  • Select an option

  • Save yeco/3870222 to your computer and use it in GitHub Desktop.

Select an option

Save yeco/3870222 to your computer and use it in GitHub Desktop.
(function ($) {
$.fn.between = function (elm0, elm1) {
var index0 = $(this).index(elm0);
var index1 = $(this).index(elm1);
if (index0 <= index1)
return this.slice(index0, index1 + 1);
else
return this.slice(index1, index0 + 1);
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment