0

I have a main page with two internal pages.

Each time I attach events on each

$(document).("pageshow","pageXXX",function(){
alert("This is a test")
})

The alert gets fired twice on the main page, also, when I call the internal pages the custom actions are performed for that page, but also the alert fired by the pageshow on the main page is also fired too.

I tried to use pagecreate instead using pageshow but it doesn't likes to me because it is fired just 1 time once the page is loaded, and I need events being fired each time the page is shown.

1 Answers1

0

Is it possible that you are missing the "#" symbol? Is pageXXX the id?

You can try using "#pageXXX", like this:

    $(document).("pageshow","#pageXXX",function(){
       alert("This is a test")
    })

Hope helps!

jcarrera
  • 795
  • 1
  • 15
  • 20
  • Hi jcarrera! Thanks for your reply. But, I´ve just missed the "#" on this post, my actual code has the "#" on it. :( – Dionisio Barboza May 21 '15 at 00:37
  • 1
    Carrera I fixed it!. The problem was that I was attaching the pageshow event for main page without using the identifiers at the moment of setting the event, just using the $(document) caused that the events gets fired in all pages from the document, even more if these pages are internal pages of the main page. Danke, Thanks, Merci, Gracias, Obrigado! – Dionisio Barboza May 21 '15 at 04:52