RNK
RNK

Reputation: 5792

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.

Upvotes: 0

Views: 367

Answers (1)

namkyu
namkyu

Reputation: 72

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.

Upvotes: 1

Related Questions