简体   繁体   中英

get newly added element's id DOM

I am adding image from php using ajax. I want to process image after getting it on DOM. I am able to load the image. but I cannot figure it out how to detect in jquery for newly inserted DOM element.

I tried with this:

document.addEventListener("DOMNodeInserted", function(event) {
    alert($(event.target).parent()[0].tagName);
});

But, It's little bit different thing.

For elements loaded post DOM load, you can use bind() or on()

http://api.jquery.com/on/ https://api.jquery.com/bind/

It would be helpful if you provided more details on what you are trying to do exactly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM