1

I have PDF.js viewer HTML structure like this:

<body>
  <div id="outerContainer">
   <div id="sidebarContainer"></div>
   <div id="mainContainer">
    ...
    ...
   <div id="viewContainer">
   <div id="viewer">
     <div class="page" data-page-number="1"></div>
     <div class="page" data-page-number="2"></div>
     <div class="page" data-page-number="3"></div>
     ...
     ...
   </div>
   </div>
   </div>
  </div>
</body>

When I try to attach on click jQuery handler everything works fine in Chrome, Edge, Internet Explorer but it doesn't work in a Firefox.

I tried both delegated events and to attach listener directly:

$("body").on("click", ".page", function(e){
    console.log("Clicked");
});

and

$(".page").on("click", function(e) {
   console.log("Clicked");
});

In Firefox I'm getting the event triggered only when I click on text but not on a white margin of a page. In other browser event is triggered whenever I click on the element with class .page.

xcentric
  • 41
  • 5
  • Possible duplicate of [JavaScript onClick does not work in Firefox](https://stackoverflow.com/questions/29636925/javascript-onclick-does-not-work-in-firefox) – Kunal Pal Feb 15 '18 at 12:50
  • It's not duplicated this question is not the same, I'm not using the event object inside the on click function and it is passed to the function just in case. – xcentric Feb 15 '18 at 12:52

0 Answers0