0

On the popular social media site reddit.com there's a feature where you can load more comments. I realize that comments are hidden for performance reasons, but I would like to expand all comments so I don't have to manually do so. The problem is you can only activate one link at a time, or they will all say 'loading...' I have tried using setTimeout and setInterval and so on. Here's a naive attempt that freezes the page:

while ($(".morecomments a:contains('load more comments')").length)
{
    $(".morecomments a").first().click();
}

Is there a way to have this "run in the background" (so it doesn't interrupt browsing and other javascript events) and click on each link once it is done loading?

1 Answers1

0

You can use jQuery "on()" method to bind click events, see following links

jQuery On

Jquery on function for future elements

Community
  • 1
  • 1
SaminatorM
  • 630
  • 5
  • 18