Here is the code, as an example of my problem:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#temp").click(function(){
$("#temp").hide();
});
$("#butt").click(function(){
$("#result").html("<div id=temp>Click to hide</div>")
});
});
</script>
<button id=butt>Show text</button>
<div id=result><!-- here goes generated html --> </div>
Question: why $("#temp").click(function(){..})
can't bee applied on newly generated html?
When I run this script, clicking on button, I get inserted code to
div *id=result*,
however, although the newly inserted code is
<div id=temp>test</div>
it is be possible to control this element by function
$("#temp").click(function(){..})
So why is that? Why it is not possible to apply early defined functions on lately inserted html?