Monday, November 8, 2010

JQuery doesn't apply to elements created after page load

Programmer Question

If I call this:



$(".month-selector").change(function(){
setStones();
});


Inside the$(document).ready() it does not apply to elements that are created later. I also tried calling the above code after creating them like so:



$("#month-selectors").html(month_selectors);

$(".month-selector").change(function(){
setStones();
});


It still doesn't work. However, If I create a static one, it works.



How can I apply this to the elements when I create them after the page loads?



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails