jQuery - Simple Step form -


i new jquery , trying build simple 3 steps form jquery. able hide gray title can't make show next step.

jsfiddle

js:

$('.js-next-step').click(function(e) {     e.preventdefault();    // 1. hide gray title   $(this).parents().next().closest('.js-title-step').hide();    // 2. show next step div   $(this).parents().next().closest('.js-step').show();    // 3. scroll next step div }); 

you can this, bit of rip-off of how bootstrap works.

$('.js-next-step').click(function(e) {     e.preventdefault();      var nextstep = $(this).attr('data-next-step');    $(nextstep).show();  }); 

essentially have data attribute on element points element want show.

  <a class="btn btn-primary js-next-step" href="#" role="button" data-next-step='.step-2'>continue step 2</a> 

in on click logic hides current step.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -