Created
June 16, 2015 12:44
-
-
Save chrisyeung1121/9f54ee0925a556d969d5 to your computer and use it in GitHub Desktop.
binding will work with AJAX created DOM
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
// Will not work after new DOM created on AJAX | |
$('.photo-options-hero').on('click', function() { | |
$(this).closest('.gallery-item').addClass('hero').siblings().removeClass('hero'); | |
}); | |
// Will work after AJAX DOM Creation | |
$('body').on('click', '.photo-options-hero', function() { | |
$(this).closest('.gallery-item').addClass('hero').siblings().removeClass('hero'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment