Zachrip
Zachrip

Reputation: 3382

Update function when page changes?

I'm working on a chrome extension for twitter and the only issue I'm running into is that when you scroll down on twitter, it adds to the page right? Well I need my jquery function to be updated when that happens, or else the click function isn't going to work on the newly loaded tweets.

Upvotes: 1

Views: 72

Answers (1)

Trufa
Trufa

Reputation: 40717

You probably need the jQuery function live() or on() prefreably.

Something like this:

$(document).on('click', '.yourClass', function() {
    //doSomething
});

This will assure that the new generated content will also be affected.

Upvotes: 3

Related Questions