Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a single html5 file which is containing various divs behaving as pages ..

I want to modify the flow of display on the basis of the choices selected on the page .

For ex

page1

link2->page2
link3->page3

page2....
link4->page4
page3....

page4..

Can anyone help me with this

Thank You
Posted

hi, using jQuery it can be done as:
JavaScript
$(document).ready(function () {
    $('#ddlChoice').live('change', function (e) {
        //for page 1
        if ($('#ddlChoice option:selected').text() == 'page1') {
            HideAll();
            $('#page1').show();
        }
        //for page 2
        if ($('#ddlChoice option:selected').text() == 'page2') {
            HideAll();
            $('#page2').show();
        }
        //for page 3
        if ($('#ddlChoice option:selected').text() == 'page3') {
            HideAll();
            $('#page3').show();
        }
        //for page 4
       if ($('#ddlChoice option:selected').text() == 'page4') {
            HideAll();
            $('#page4').show();
        }
    });
});
function HideAll() {
    $('#page1').hide();
    $('#page2').hide();
    $('#page3').hide();
    $('#page4').hide();
}
here ddlChoice is the dropdown containing options page1, page2, page3 and page4
hope this will help you
 
Share this answer
 
Comments
gaurish thakkar 9-Jul-12 6:50am    
what if i have many rules and for each page in html i have to apply those rules for those question ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900