Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Best method of implementing a wizard using jQuery / Javascript

  • 17-09-2015 10:09pm
    #1
    Registered Users, Registered Users 2 Posts: 5,692 ✭✭✭


    Hello all,

    Just geting familiar with Javascript and jQuery over the last few days. I'm planning on putting together a web page that will include a GUI-like wizard. What would be the best method of implementing something like this?

    Would it be something along the lines of..
    $("nextButton").click( function() {
    $("sectOne").html( ... )
    $("sectTwo").html( ... )
    });

    Am I going about this the wrong way / too literally?


Comments

  • Registered Users, Registered Users 2 Posts: 5,692 ✭✭✭Danger781


    Danger781 wrote: »
    Hello all,

    Just geting familiar with Javascript and jQuery over the last few days. I'm planning on putting together a web page that will include a GUI-like wizard. What would be the best method of implementing something like this?

    Would it be something along the lines of..
    $("nextButton").click( function() {
    $("sectOne").html( ... )
    $("sectTwo").html( ... )
    });

    Am I going about this the wrong way / too literally?

    Looked up some basic wizard examples and some posts on stack overflow. Seems like the best implementation would be dividing the entire form into sections and then using show() and hide() as needed.

    Ill probably go with this method unless someone else has a more intelligent alternative.


  • Registered Users, Registered Users 2 Posts: 6,262 ✭✭✭Buford T Justice


    a bit more information would help, but failing that http://www.jquery-steps.com/


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    Use CSS and the :target selector along with anchors, could be a nice JavaScript free alternative. Can animate in CSS as well as use the back button ;)
    <style>
        .step { max-height:0; overflow-y:hidden; opacity:0; transform; transition: opacity .15s ease-in-out  }   
        .step:target {  max-height:100%; overflow-y:visible; opacity:1;  }
    </style>
    <a href="#Step1"> Start Wizard! </a>
    <div id="Step1" class="step">
       <p>This is step 1</p>
       <a href="#Step2">Next</a>
    </div>
    <div id="Step2" class="step">
       <p>This is step 2</p>
       <a href="#Step1">Prev</a>
       <a href="#Step3">Next</a>
    </div>
    <div id="Step3" class="step">
       <p>This is step 3</p>
       <a href="#Step2">Prev</a>
    </div>
    


  • Registered Users, Registered Users 2 Posts: 5,692 ✭✭✭Danger781


    a bit more information would help, but failing that http://www.jquery-steps.com/

    Came across that library alright but I'm doing this as a learning experience - So I'd like to do it all myself. Thanks for the suggestion though!
    Giblet wrote: »
    Use CSS and the :target selector along with anchors, could be a nice JavaScript free alternative. Can animate in CSS as well as use the back button ;)

    Definitely an option, thanks. Like I said above I am doing this more as a learning experience so ideally I would use JS / jQuery but I guess I could try both and decide which implementation I prefer.

    On that note is there any disadvantage to using JS over CSS for something like this? I would imagine 99% of people have Javascript enabled in their web browser nowadays..


  • Registered Users, Registered Users 2 Posts: 6,287 ✭✭✭Talisman


    Take a look at the FormWizard jQuery plugin.

    https://github.com/thecodemine/formwizard


  • Advertisement
Advertisement