I'm using jqlight(similair to jquery but it doesn't have $document.data('events')) to bind a keypress to document.
$document.bind('keypress', function(event){
I add bind the key press when a checkbox is checked, like this:
if(onScreenData.getChecked().length > 0){
$document.bind('keypress', function(event){
else{
$document.unbind('keypress');
}
where onScreenData.getChecked().length
is the number of checkboxes.
I want to only bind the keypress when the number of checked checkboxes goes from 0 1.