1

I am writing a plugin for a website, where I create a couple of table-rows and they get injected into an already existing table on the website.

My table-rows will get created when a button is pressed, however I have no access to this button since it's already on the website, not in my plugin.

Is it possible for me to create a JS function that runs when my table-rows are created?

Erik
  • 293
  • 1
  • 8

1 Answers1

1

Transforming my comment as an answer for future viewer to see :

Maybe you can use what in this answer : https://stackoverflow.com/a/9845549/10153945 It detect a change in the DOM using jquery

in this answer courtney christensen propose to use jQuery's DOMSubtreeModified to detect changes

$('#content').bind('DOMSubtreeModified', function(e) {
  if (e.target.innerHTML.length > 0) {
    // Content change handler
  }
});

Look at his answer and upvote him too ; )

jonatjano
  • 3,576
  • 1
  • 15
  • 20