Created
October 17, 2021 17:32
-
-
Save diamantidis/9b70a6b0f3fb1dd7d3113107881a541d to your computer and use it in GitHub Desktop.
Event handler for toggle (for Medium post)
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
<script type="text/javascript"> | |
var _selector = document.querySelector('input[name=myCheckbox]'); | |
_selector.addEventListener('change', function(event) { | |
var message = (_selector.checked) ? "Toggle Switch is on" : "Toggle Switch is off"; | |
if (messageHandler) { | |
messageHandler.postMessage(message); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment