Reputation: 1344
I'm using this code for append some code using jQuery but it won't work.
$('#'+DivId).append($(maincontent).fadeIn('slow'));
but if I use this then it works perfectly
$('#'+DivId).html(maincontent);
Does anybody know what is the problem with append()
?
Thanks
Upvotes: 1
Views: 61
Reputation: 165971
Your code should work fine. It may be that you need to run inside a $(document).ready
function:
$(document).ready(function() {
var maincontent = "<p>Just some text to test...</p>";
$("#test").append($(maincontent).fadeIn('slow'));
});
You can see the above code running here.
Upvotes: 0
Reputation: 50976
use this
$("#your_div").fadeIn('slow');
$('#'+DivId).append(maincontent);
Upvotes: 1