ghinda / css-toggle-switch

Accessible, CSS-only, toggle switches

Home Page:http://ghinda.net/css-toggle-switch/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to stop toggle based on window.confirm()

JohnHanks opened this issue · comments

I am using the radio flavor of your css-toggle-switch. I want to use window.confirm() in order to make sure a user REALLY wants to toggle the radio to ON or OFF.

How do I force the toggle-switch to not toggle if the user clicks Cancel in the Confirm dialog?

I can force my code down the line not to run based off this confirm, however the toggle-switch still appears to toggle.

Will preventDefault() on the click event on the label accomplish this?

Edit: I'm a dope. I wasn't passing the click event to my function properly. ALL IS WELL!

delete me plz 😄