Karam Haj
Karam Haj

Reputation: 1250

Uncaught TypeError: $.mobile.pageContainer.pagecontainer is not a function

what I'm trying to do is to move from page to anthor page by this code :

if (($("#UserIDTXT").val() == "3164") && ($("#UserPassTXT").val()) == "12345678")
    $.mobile.pageContainer.pagecontainer("change", "#HomePage", { reloadPage:true });

any mistakes ?

Upvotes: 0

Views: 396

Answers (1)

Elliot B.
Elliot B.

Reputation: 17651

If you are getting an error that $.mobile.pageContainer.pagecontainer is not a function, then either you are not including the jQuery Mobile library correctly, you are using an old version, or you are executing your pageContainer code before the document has fully loaded.

Additionally, your usage of the change action is slightly incorrect.

Change this:

if (($("#UserIDTXT").val() == "3164") && ($("#UserPassTXT").val()) == "12345678") $.mobile.pageContainer.pagecontainer("change", "#HomePage", { reloadPage:true });

To this:

if (($("#UserIDTXT").val() == "3164") && ($("#UserPassTXT").val()) == "12345678") {
    var jqHomePage = $("#HomePage");
    $.mobile.pageContainer.pagecontainer("change", jqHomePage, {});
}

I removed the reloadPage option in your first example because it is deprecated as of jQuery Mobile 1.4.0 and should not be used.

Upvotes: 1

Related Questions