Created
November 29, 2016 18:23
-
-
Save marcoala/68895bdcbf4dc06689015a5a0470b3ed to your computer and use it in GitHub Desktop.
jQuery - listen for event
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
| //listen on event on an element that is in the DOM when the page load | |
| $('#my_element').change(function(e){ | |
| //do stuff | |
| }); | |
| //listen on event on an element that is NOT in the DOM when the page, formerly .live() | |
| $(document).on( 'change', '#my_element', function(e) { | |
| //do stuff | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment