I'm rather new to jQuery and JavaScript and I'm trying to develop a webpage that does something that probably isn't entirely reasonable, but from what I know of jQuery it seemed like a quick and easy design. The code is something like:
<script>
$(document).ready(function() {
$("button" ).click(function() {
$("#target").html('<div><p>Some HTML</p><div id="clickHere"></div><div id="target2"></div></div>');
});
$("#clickHere").click(function(){
$("#target2").html('<p>Replacement HTML</p>');
});
});
</script>
<div id="target"></div>
There are styling elements and the identifiers are different in the actual code, but the general functionality I'm going for is the user selects a content area. That content is then generated by the first click function call. Within that content is further stratification that I would like to allow the user to select from and then generate the final level of content. I'm guessing there is some underlying mechanism that won't allow for the "target2" click event to fire for the content dynamically generated from the "target" div. But if I'm just doing something wrong, I appreciate the help!