Created
December 11, 2017 23:30
-
-
Save javanigus/172aa54a48c18c1b6e04d8bfb35f78bd to your computer and use it in GitHub Desktop.
jQuery handle event of dynamically-created element
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
$("body").append("<div class='a'></div>"); | |
$(document).on("click", "div.a", function (event) { | |
// do something when the div is clicked | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment