Skip to content

Instantly share code, notes, and snippets.

@PetraMotz
Last active August 4, 2021 11:13
Show Gist options
  • Save PetraMotz/2c7aa316a5ba291f307f79418aa21b15 to your computer and use it in GitHub Desktop.
Save PetraMotz/2c7aa316a5ba291f307f79418aa21b15 to your computer and use it in GitHub Desktop.
jQuery #double click #prevent #js
jQuery('.checkbox_datenschutz_0').on('click', function(e){
if (e.target != this) { <- hier wird mit nur this das DOM Object angesprochen, nicht wie bei $(this) das jQuery objekt.
e.preventDefault();
}
if($(this).hasClass('wasChecked')){
console.log('remove');
$(this).removeClass('wasChecked');
}
else{
$(this).addClass('wasChecked');
console.log('add');
}
});
e.stopImmediatePropagation()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment