I'm writing a chrome extension that edits certain reddit posts. Reddit scrolls infinitely, so new posts are continously added. My current solution to this is to run my jquery function once per second. Is there a better way to go about this?
Asked
Active
Viewed 30 times
0
-
2Possible duplicate of [Event when element added to page](https://stackoverflow.com/questions/7434685/event-when-element-added-to-page) – Blauharley Jun 02 '18 at 08:42
-
if new items appears by scrolling, trigger your function on `Scroll` event. Also if you have complex process on elements, hold the number of target elements in a temporary variable and before repeating the processes, count target elements again. – Ali Sheikhpour Jun 02 '18 at 08:47