Reputation: 559
I have the following code and try to make the result of the ajax fade in
$.post('e.php', {term: $(this).text()} , function(data) {
$('#dictionary').html(data).fadeIn("slow");
})
This is not working. How I must edit it, to make the results fade in the div
?
Thanks in advance
EDIT
Everything works fine, except the effect, it doesnt take place. I see the results appear in the div
, not fade in it.
Upvotes: 0
Views: 1776
Reputation: 219057
In response to your comment:
@David yes it is visible
What do you expect .fadeIn()
to do on an element that's already visible? There's nothing to "fade in." The element needs to be hidden first. Either style it to be hidden by default via CSS:
#dictionary {
display: none;
}
Or hide it inline with the JavaScript code:
$('#dictionary').hide().html(data).fadeIn("slow");
Upvotes: 0
Reputation: 2188
It may have to do with the fact that #dictionary
might be visible before the fadeIn()
call. See this question.
Upvotes: 1