3
I’m trying to do a check with a Bootstrap Wizard
that I am using, I need the steps to be enabled if certain checks
are marked, otherwise the next step cannot be enabled.
I have these steps on the form:
<div class="form-bootstrapWizard">
<ul class="bootstrapWizard form-wizard">
<li class="active" data-target="#step1">
<a href="#tab1" data-toggle="tab"> <span class="step">1</span> <span class="title">Termo 1</span> </a>
</li>
<li data-target="#step2">
<a href="#tab2" data-toggle="tab"> <span class="step">2</span> <span class="title">Termo 2</span> </a>
</li>
<li data-target="#step3">
<a href="#tab3" data-toggle="tab"> <span class="step">3</span> <span class="title">Termo 3</span> </a>
</li>
<li data-target="#step4">
<a href="#tab4" data-toggle="tab"> <span class="step">4</span> <span class="title">Salvar</span> </a>
</li>
</ul>
<div class="clearfix"></div>
My attempt to make that check is like this:
if($("#CheckTermo1").is(':checked')){ if("data-target" == "#tab2"){ $(".next").prop("disabled", true); } else { $(".next").attr("disabled",false); } }
I have the CheckTermo1
that marked should enable the step2
, the CheckTermo2
will enable the step3
and the CheckTermo3
will enable the step4
.
The checks are like this:
<input name="CheckTermo1" type="checkbox" class="checkbox style-0" id="CheckTermo1" value="0" required>
<input name="CheckTermo2" type="checkbox" class="checkbox style-0" id="CheckTermo2" value="0" required>
<input name="CheckTermo3" type="checkbox" class="checkbox style-0" id="CheckTermo3" value="0" required>
Where is this class
.next
?– Sam
Hello @Sam, this class is on the button: <li class="next"> <a href="javascript:void(0);" class="btn btn-lg txt-color-Darken"> Next </a> </li> But it has nothing to do with my attempt.
– adventistapr
So in case you want to change which div will have the class
class="active"
according to the checkbox marked?– Sam
I’m not sure if that would be it, but when you click on the above navigation would be enabled.
– adventistapr
But the data-target is as
#step2
and not as#tab2
. The#tab2
is in href. It has something to do?– adventistaam
Try going through the list of
li
.$( ".form-wizard> li" ).each(function( index ) {
 let target = $(this).data('target')
 if(target == '#tab2'){
 // seu codigo
 }
 });
within theif($("#CheckTermo1").is(':checked')
– adventistaam