Using jQuery to watch for an on click event for the popup pagination

335
3
Jump to solution
01-14-2019 03:48 PM
JayHill
Occasional Contributor II

Doesn't seem to be working. 

I am trying to watch the esri-popup__pagination-next class.

This the code I've tried. Is there a better way to do this?

$( ".esri-popup__pagination-next" ).on( "click", function(e) {

query(".esri-popup__pagination-next").on("click", function(e) {‍‍‍
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Jay,

   Your issue is that the popup next button is not part of the dom when you execute that code so the query returns a null pointer. You need to ensure the object exists in the dom first.

      watchUtils.whenOnce(view.popup, "visible", function(){
        query(".esri-popup__button.esri-popup__pagination-next").on("click", function(e) {
          console.info(e);
        });
      });

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Jay,

   Your issue is that the popup next button is not part of the dom when you execute that code so the query returns a null pointer. You need to ensure the object exists in the dom first.

      watchUtils.whenOnce(view.popup, "visible", function(){
        query(".esri-popup__button.esri-popup__pagination-next").on("click", function(e) {
          console.info(e);
        });
      });
JayHill
Occasional Contributor II

Thanks Robert!

It is now working, although only for the previous button, not the next button. It also fires when you click on the numbers.  I have it querying ".esri-popup__button"

I have tried quite a few combinations of classes and elements. I think.

Any idea why it wouldn't fire on the next button?

0 Kudos
JayHill
Occasional Contributor II

.esri-popup__navigation worked!

0 Kudos