Just a little update to my checkbox range selection jQuery plugin to allow chaining. I'd forgotten to return 'this' at the end of the function. Here's the full source, including the mod:
(function($) {
$.fn.enableCheckboxRangeSelection = function() {
var lastCheckbox = null;
var $spec = this;
$spec.bind("click", function(e) {
if (lastCheckbox != null && e.shiftKey) {
$spec.slice(
Math.min($spec.index(lastCheckbox), $spec.index(e.target)),
Math.max($spec.index(lastCheckbox), $spec.index(e.target)) + 1
).attr({checked: e.target.checked ? "checked" : ""});
}
lastCheckbox = e.target;
});
return $spec;
};
})(jQuery);
You can check the project page as well, for full history and updates.
0 Responses to “Checkbox Range Selection Update”
Leave a Reply