Using Bootstrap 3 Tabs, a user can hit the tab key to change the focus from Nav Tab 1 to Nav Tab 2, etc. However, simply focussing on that Nav Tab does not cause the Tab Content to change. See the examples http://getbootstrap.com/javascript/#tabs-examples
We are building a form where there are inputs in each Nav Tab and then instructions for that input in the Tab Content. Ideally, if a user his the Tab button to navigate from input to input, the Tab Content will change accordingly.
What would we need to do in order for the Tab Content to change along with Tabbing through the navigation?
Thanks!
Here's my navigation code:
<li role="presentation">
<div class="row">
<div class="col-xs-5 col-sm-4" style="padding:0px 5px;">
<p class="sidep">Sternum Notch:</p>
</div>
<div class="col-xs-1 hidden-sm hidden-md hidden-lg" style="padding:0px 0px;">
<a data-toggle="collapse" href="#collapseSternumNotch" aria-expanded="false" aria-controls="collapseSternumNotch" tabindex="-1">
<i class="fa fa-question-circle"></i>
</a>
</div>
<div class="tablink">
<a href="#section2" aria-controls="section2" role="tab" data-toggle="tab" tabindex="-1" aria-expanded="false">
<div class="col-xs-6 col-sm-8" style="padding:0px 0px;">
<input type="number" class="form-control" name="sternumNotch" placeholder="inches">
</div>
</a>
</div>
</div>
<div class="collapse" id="collapseSternumNotch">
<div class="well">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/pNSZt8AUiw4?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
<h4>Sternum Notch</h4>
<p>In your socks or bare feet, stand with your heels and buttocks against the wall and your feet 8" apart. Find the notch at the top of your ribcage/ bottom of your neck. Measure from the ground to the bottom of the sternum notch.</p>
</div>
</div>
</li>
Here's my Tab Panel Code:
<div role="tabpanel" class="tab-pane" id="section2">
<div class="row">
<div class="col-sm-12">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/pNSZt8AUiw4?rel=0" frameborder="0" allowfullscreen=""></iframe>
</div>
<br />
<h2>Sternum Notch</h2>
<p>In your socks or bare feet, stand with your heels and buttocks against the wall and your feet 8" apart. Find the notch at the top of your ribcage/ bottom of your neck. Measure from the ground to the bottom of the sternum notch.</p>
</div>
</div>
</div>
And here's my jquery:
$(".tablink input").on("focus", function() {
$(".tablink").closest("a").attr("aria-expanded","true");
});
$(".tablink select").on("focus", function() {
$(".tablink").closest("a").attr("aria-expanded","true");
});