JQuery delete DOM element after fading out

前端 未结 3 2021
旧巷少年郎
旧巷少年郎 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:01

    or $.remove($(this));

    0 讨论(0)
  • 2021-01-31 03:13

    why messing here just use $('#anydiv').remove();

    0 讨论(0)
  • 2021-01-31 03:20

    You're using the remove() function wrongly.

    $(element).click(function() {
        $(this).fadeOut(500, function() { $(this).remove(); });
    });
    
    0 讨论(0)
提交回复
热议问题