JQuery delete DOM element after fading out

前端 未结 3 2078
旧巷少年郎
旧巷少年郎 2021-01-31 02:35

I want to delete an DOM element right after fading out. What I did so far is

$(element).click(function()
{
    $(this).fadeOut(500, function() { $().remove(this)         


        
3条回答
  •  天命终不由人
    2021-01-31 03:20

    You're using the remove() function wrongly.

    $(element).click(function() {
        $(this).fadeOut(500, function() { $(this).remove(); });
    });
    

提交回复
热议问题