In my webpage I have certain divs showing data of user. On a certain event I need to remove each div clicked. I thought to make it a little bit fancier before removing the div.
So I used animate method and inside callback of animate method I wrote the code to remove that div from dom. But the problem is that it shows that remove cannot be called on null. How is it that animate method ran on that div and inside its callback it became null.
Please help me in resolving the issue and also suggest if there is a better way to do it.
confirmOpen = //Holding reference of div to be removed.
//animate method is running perfectly fine.
confirmOpen.animate({"width":"1px","height":"1px"},500,function()
{
console.log(confirmOpen); //Logging null
confirmOpen.remove(); //Showing error that remove method cannot be called on a null value.
});