Clement Dungler
Clement Dungler

Reputation: 747

jQuery Mobile 1.4.0 navigate then comes back

I have a strange problem with my jQuery mobile application. I used a single html file with multiple pages.

My problem is in the navigation, here is what append :

PageA ==(navigate)==> PageB ==> PageC => Click Home button (from dialog) -> Back to PageA.

Everything is fine, my page shows events are as I want.

I can do these actions 2-3 times and the 4th time here is the problem :

This is my OnClick :

$("#VisitHomeButton").on("click", function(e) {
    e.preventDefault();
    e.stopPropagation();

    $.mobile.navigate('#patientListPage');
    return;
});

I noticed, by using breakpoints, that the PageC event fires just after PageA event but not wait the end of my PageA method.

I am stuck on this since 3 days. If someone have any idea how to find the source of this problem it would be great.

Thanks

Upvotes: 0

Views: 453

Answers (1)

Clement Dungler
Clement Dungler

Reputation: 747

What a stupid error.

On my PageB :

$(document).on("pageshow", "#PageB", function() {
    $("#checkIDButton").click(function(event) {
        $.mobile.navigate("#VisitPage");
    });
});

just add :

$("#checkIDButton").off();

Fixed everything.

Upvotes: 1

Related Questions