Created
July 21, 2022 21:10
-
-
Save cobaltapps/783ca5dcf9a174cd3802f8fe1cc9a4b3 to your computer and use it in GitHub Desktop.
How to override an inline onclick event.
This file contains 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
// Setting the DOM element's onclick to null removes the inline click handler | |
$('#example-button')[0].onclick = null; | |
// Then you can add your own custom click event function | |
$('#example-button').click(function() { alert('My Custom Click Event') }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment