JQuery - use element with DOMNodeInserted

前端 未结 1 378
盖世英雄少女心
盖世英雄少女心 2020-12-09 06:17

For sure this question is very easy, but I just cannot figure this out.

I\'m using DOMNodeInserted event to detect when a new element is inserted.

I don\'t k

相关标签:
1条回答
  • 2020-12-09 06:39

    You probably need to initialize a jQuery object around element.target. Try:

    document.addEventListener("DOMNodeInserted", function(event) {
        alert($(event.target).parent()[0].tagName);
    });
    
    0 讨论(0)
提交回复
热议问题