`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 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.