Ofir Ohayon
Ofir Ohayon

Reputation: 367

Jquery Mobile Pop not opening on event

I Have the next script:

function validateForm() {
    var mp = document.forms["local_storage_form"]["mphone"].value;
    var hp = document.forms["local_storage_form"]["hphone"].value;
    if (hp == "" && mp == "") {
        $('.tooltip2').fadeIn('slow');
        return false;
    } else {
        localStorage.setItem('submit',1)
        $('.tooltip2').fadeOut('fast');
        $('#vaild').fadeOut('fast', function() {
            $(this).replaceWith('<img src="images/ajax-loader.gif">');
            $('#vaild').fadeIn("fast");
            $("#myPopup").load("ajax.txt");
            $('#myPopup').open;

        });
        setTimeout(function() {


            $.mobile.changePage("#rent");
        }, 5000);
    } 
}

and the function is activated by $(document).on("click") event,but the popup isn't opening, i want the popup will stay for 5 seconds and then $.mobile.changePage will be activated.

What's wrong with my Code?

Upvotes: 0

Views: 54

Answers (2)

xited
xited

Reputation: 877

You forgot to include a $ sign in front of the page you're changing to. Following is the correct call:

$.mobile.changePage($('#rent'));

See the following jsfiddle for a working demo.

Upvotes: 1

Jean-Pierre
Jean-Pierre

Reputation: 9

You're missing a semi-colon on this:

localStorage.setItem('submit',1)

It should be:

localStorage.setItem('submit',1);

Upvotes: 0

Related Questions