My parent div has a unique feature where clicking on it reveals one of the child divs, and clicking again toggles the visibility of the child div. Inside this child div, there is a switch toggle that functions as a hidden checkbox. The issue I'm facing with my code is that when I click on the switch toggle, it triggers both the switch event and the parent click event.
I have attempted various solutions from Stack Overflow for similar questions, such as using e.stopPropagation();
on the child click event and if(e.target == this)
on the parent click event, but none of them have resolved the problem.
Any assistance would be greatly appreciated.
Please refrain from marking this as a duplicate, as I have tried all suggested solutions without success. Thank you.
Demo: jsfiddle