0

I want to call a event everytime elements are added. Im using JQuery, which has built-in functions to accomplish adding events to all elements (so also elements that get added later) that match a selector, which looks like this:

jQuery("body").on("click", ".selection", function (evt, selector) { passSelectorToOtherFunction(selector) })

But unfortunately i don't want to put a "click"-event-handler on it, i just want to know when they get added so i can do stuff with them (without having to do that explicitly after each ajax call).

So basically, i'd need something like a 'ready'-event which is available for all elements, like:

jQuery("body").on("ready", ".selection", function (evt, selector) { passSelectorToOtherFunction(selector) }).

Thanks in advance

user1557232
  • 107
  • 1
  • 2
  • 8

1 Answers1

0

Have you had a look at liveQuery? It should allow you to do what you need.

Moin Zaman
  • 25,281
  • 6
  • 70
  • 74