0
`enter code here`I am working on a jquery mobile html5 application.I have various pages with page id-"page1"...


Onclick of button i want a parameter to be passed with the function on which the navigation will be taking place.

for ex

<input type="button" data-transition="fade" value="Next"  onclick="checkIfValid('2');"
                            data-icon="arrow-r" data-iconpos="right">

so it redirects to the correct page...


how can i modify the 

function checkIfValid(page){
                var pag=page;
                alert(pag);
                switch (page){
                    case '2': alert('hi');
                    if ($('#page2').data('bValidator').validate())
                    {
                        $.mobile.changePage('#page3', { transition: "slideup" })
                        return true;
                    } else
                    {
                        return false;
                    }
                    break;
                    case '3': if ($('#page3').data('bValidator').validate())
                    {
                        $.mobile.changePage('#page4', { transition: "slideup" })
                        return true;
                    } else
                    {
                        return false;
                    }
                    break;

                }
            } 


function


in order to make it more dynamic 
2
Contributors
1
Reply
4
Views
5 Years
Discussion Span
Last Post by LastMitch
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.