Question: Im using the jquery load function to refresh the contents of a div. 

I start by hiding the div

```
$('.dashboard-body').fadeOut(50);

```

Then ajax load - to refresh the content

After the load event and while the refreshed div is still hidden id like to click on one of the contents pagination links. Then when the div is shown again the correct content is shown.

Heres the code that doesnt work. Im using the livequery plugin as a listener for new elements in the DOM.

```
$('.dashboard-body').load(target, function(){
                $('.pagination ul li a').livequery(function(){
                    $(this).each(function(){
                        var target_page = $(this).html();
                        if(target_page == return_page){
                            $(this).click();
                        }
                    });
                });

                $('.dashboard-body').fadeIn('slow',function(){
                    //success
                });

            });

```

The code above in my mind does the following. 

It loads the target page back into the div with class dashboard-body.

Its listens for new pagination links loaded into the dom using livequery 

It then iterates over each link found

It finds the links numerical value ie. 1, 2, 3.... and defines as the a potential target page number.

Then if the target page and return page number (which is a predefined variable) are equal. Click this link.

It all seems to work and using the console i can see that this statement...

```
if(target_page == return_page){

```

is true once as expected but the click event wont happen as if the element doesnt exist but it should do as its just iterated over them.

I cant see whats wrong any ideas? or is there a better way?

Answer: 
This might be what you are looking for...

<http://www.pinlady.net/PluginDetect/PDFjs/>
This will test for it. I can't get to the other link due to corporate firewall. Dunno what it says. Maybe its the same.

[FIDDLE HERE](http://jsfiddle.net/bWstc/)

```
<iframe src="some.pdf" id="iframe" name="iframe"></iframe>

```

.

```
// FireFox test for PDFJS to display PDFs. Works in 20 & 21.
// If you don't test for the browser ...
//    IE says PDFJS is there. It isn't.
//    Chrome hangs on the fiddle
//    Safari for Windows says PDFJS isn't there
$(window).load(function() {

  var userAgent = navigator ? navigator.userAgent.toLowerCase() : "other";
  if(userAgent.indexOf("firefox") > -1) {

    var $iframe = $("#iframe");
    var $innerDiv;
    try {
      $innerDiv = $iframe.contents().find('div');
      alert("PDFJS not loaded");
    } catch (e) { 
      alert("PDFJS loaded");
    }
  } else {
      alert("Not running in FireFox - no PDFJS available");
  }
});

```