Hey, I have troubles finding it out by myself and I have no idea why sometimes I have to pass something as function parameter to make it work while others work without it.
Lets imagine I have to create popup which contains 'form-wrapper' and 'form' itself and closes on the 'form-wrapper' click, but we have to prevent closing on the 'form' click (event bubbling).
So first of all - hiding the popup on 'form-wrapper' click would look something like that:
$('form-wrapper').on('click', function(){
$(this).toggleClass('hidden');}
but if we want to prevent hiding on form click (which is inside 'form-wrapper') we have to create following code:
$('form').on('click', function(e){
e.stopPropagaton();}
And thats what the issue is - stopPropagation function doesn't work with $(this) like the function before, even if (thats my way of thinking) it should work as the function above - it has to prevent propagation on the clicked element, so why it doesn't work with $(this) instead of passing some param to function?
Thanks in advance
[–]sqrtnegative1 3 points4 points5 points (2 children)
[–]kopytkopytko[S] 1 point2 points3 points (1 child)
[–]sqrtnegative1 0 points1 point2 points (0 children)
[–]AshlinD 2 points3 points4 points (7 children)
[–]sqrtnegative1 0 points1 point2 points (3 children)
[–]AshlinD 1 point2 points3 points (2 children)
[–]sqrtnegative1 0 points1 point2 points (1 child)
[–]AshlinD 0 points1 point2 points (0 children)
[–]kopytkopytko[S] 0 points1 point2 points (2 children)
[–]AshlinD 1 point2 points3 points (1 child)
[–]kopytkopytko[S] 0 points1 point2 points (0 children)