Skip to content

Instantly share code, notes, and snippets.

@Chavao
Created May 18, 2012 17:18
Show Gist options
  • Save Chavao/2726521 to your computer and use it in GitHub Desktop.
Save Chavao/2726521 to your computer and use it in GitHub Desktop.
$.fn.invertOnClick = function(context) {
return this.click(function(e) {
e.preventDefault();
context.each(function(i) {
if($(this).is(':visible'))
{
var inputCheck = $(this).find('input[type=checkbox]');
if(inputCheck.is(':checked'))
inputCheck.removeAttr('checked');
else
inputCheck.attr('checked','checked');
}
});
});
}
$('#btn-invert').invertOnClick($('#layer-list').find('.tl_resumo_telemetria'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment