function wont work after use of append()
My script places all of the JQuery inside $(document).ready(function() { }); as standard.
Some of the pages Divs are static
and some are created dynamically using the append function - this is my append code
$('#data').append("<div id=\"stenchblossomchart\" class=\"chart\"></div>");
(note that in that example data is the ID of a static DIV element)
the problem comes when i try to detect an event on div created by this append code - my code is as so
$("someobject").click(function(){
alert("sam");
});
This code works on static divs but will not work on any of the append created divs
why is this, do i need to make the JS refresh the dom after using append and before event detection will work on it?
if yes
how do i do this?
and
why is it that i am able to modify the contents of append created DIVS after they have been created but i cant make a click event work on them.