Custom Javascript Not Loading On Paginated Pages (Except First Page) I am running the following jQuery that affects elements on a page view. 

$(document).ready(function($){                    
    $(".views-field-field-video").click(function() {
        $(this).parent().find("a.cboxElement").click();
    }); 
}); 


The code works perfectly, but only on the first page. When I use the pager at the bottom and navigate to any other page, the script does not work. Then, when I navigate back to the first page, the script also fails. 

If I reload the page however, it brings me back to the first page and the script works again.  

EDIT: The classes I am selecting in the script remains the same on all pages.
The problem is when using ajax pagination in the view, document.ready isn't called.

Instead you should follow best practice and use Drupal.behaviors instead.

That way, the behavior will run on document.ready and on the ajax refresh.

Try this:


(function ($) {

  Drupal.behaviors.cboxClick = {
    attach: function (context, settings) {
      $(".views-field-field-video").click(function() {
        $(this).parent().find("a.cboxElement").click();
      }); 
    }
  };

})(jQuery);