0

I have display html on page using jquery-ajax call. But javascript on that page not working for html added from jquery-ajax response. I tried "async:false " but this one working for on window load. I want to make it working for Click event as well. Is there any solution to use existing javascript for appended or replaced html on click event?

Navdeep
  • 11
  • 1
  • 4
  • You need to use delegated event handlers when dealing with dynamically appended content. See the duplicate for more information – Rory McCrossan Jun 22 '18 at 08:43
  • i am using this code on load :
    function getPage(id, tab_id){Query.ajax({
                        url: "testfile.php",
                        data: 'id=' + id,
                        type: "POST",
                        async: false,
                        success: function (data) {
                            
                            $('#' + tab_id).html(data);
                            
                        }
                    }); }  And i want to call this method on click event. On window load existing javascript on page is working. On click event its not.
    – Navdeep Jun 22 '18 at 12:24

0 Answers0