Created
October 2, 2015 18:33
-
-
Save aestrro/cceb2d146ab7548958aa to your computer and use it in GitHub Desktop.
Triggering Elements after DOM loaded
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
// Append anchor tag after DOM load | |
$('.container').append("\ | |
<a href='#' class='someclass'>Give me a cookie?</a>\ | |
") | |
// Attach click event to .someclass, et voilà | |
$(document).on("click",".someclass" ,function(e){ | |
e.preventDefault(); | |
console.log("ayyyyy!"); | |
}); | |
// ayyyyy! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment