[jQuery] Problem with animate callback
Hi,
I have sth like this:
function resizeSquare() {
var $square = $('#square');
$square.animate({ width: "300px", marginLeft: "-150px"}, 800)
.animate({ height: "400px", marginTop: "-200px"}, 800, function() {
$(this).html('<a href="#" class="clicked">clicked</a>');
});
}
In second animate function I use callback to insert link in
div#square. And everything is ok.
Then I want to display alert after clicking on this link, but nothing
happens. This is function which should display alert:
function showAlert() {
$('a.clicked').click(function() {
alert("Display me!");
return false;
});
}
If I insert this link outside animate callback everything is ok. So,
I'm doing sth wrong or it's jquery bug/behavior?
And I use jQ 1.3.1.
With regards,
dreame4