I've been using jQuery for a while now but this problem has never happened before.
Basically, HTML:
<div class="button three"></div>
<div id="Content"></div>
CSS:
.button.three {
width: 50px;
height: 50px;
background: blue;
}
.textBlock {
background: orange;
height: 20px;
width: 20px;
}
jQuery:
$(document).ready(function () {
$(".button.three").click(function() {
$("<div class='textBlock'></div>").appendTo("#Content");
});
$(".textBlock").click(function() {
alert("2");
});
});
See the JSFiddle: http://jsfiddle.net/Brannie19/cQk8t/
Why doesn't this work?
---EDIT---
I was wondering why the click event on .textBlock
wouldnt fire. The answers from dsaa and net.uk.sweet actually explained it to me, so thank you guys.