Last active
August 4, 2021 11:13
-
-
Save PetraMotz/2c7aa316a5ba291f307f79418aa21b15 to your computer and use it in GitHub Desktop.
jQuery #double click #prevent #js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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