jQuery - Simple Step form -
i new jquery , trying build simple 3 steps form jquery. able hide gray title can't make show next step.
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
Post a Comment