Access through JavaScript / Jquery an element that came from AJAX after the DOM LOAD

5

I am developing a WEB APP with AngularJS, there is an element that is coming to the DOM after its loading, I am trying to write an event:

$('elemento').click()

But when you finish rendering the page the element does not yet exist because it is coming from ajax through the Angle, and because of that the event is not being associated with it.

How to associate Events or Capture elements, which enter the DOM after your LOAD?

    
asked by anonymous 16.04.2015 / 00:33

1 answer

1

I solved my problem! I needed to make an element that came dynamically through AJAX to be recognized via JavaScript / JQuery and to be able to write an Event for this element.

To do this through the .live () method of JQuery, follow the example:

$('elemento').live('click',function(){})
    
16.04.2015 / 16:22