Here is some code that I am working with:
$('body').on('click' , function(){
$('body').append('<div class="ajax-success"><p>Its Done !!!</p></div>').fadeOut(2000);
});
The goal was to add a div and then remove it with a fadeout effect using the fadeOut() method. However, the above code ends up fading out the entire html document instead of just the particular div.
I have come across similar threads on SO, but they mainly address issues with fadeIn effects which do not apply in my case. Additionally, upon reviewing the documentation, I realized there is no callback function available for the append() or appendTo() methods that could potentially solve this issue. So, how can I successfully implement a fade effect on the div added through the append() method?