简体   繁体   中英

Changing tab on button click

i have this code for implementing tab for the website

 <span style=" float: left; width: 131px; padding: 8px 0px 8px 0px;color: #fff; font-size: 20px;background: none; text-align: left; margin: 0% 0% 0% 9%;" > 6 more steps :</span>
                <input type="radio" name="sky-tabs" checked="" id="sky-tab1" class="sky-tab-content-1">
                <label for="sky-tab1"><span><span> <i class="fa fa-angle-double-right"></i> Travel Data
</span></span></label>

                <input type="radio" name="sky-tabs" id="sky-tab2" class="sky-tab-content-2">
                <label for="sky-tab2"><span><span> <i class="fa fa-angle-double-right"></i> Hotels
</span></span></label>

                <input type="radio" name="sky-tabs" id="sky-tab3" class="sky-tab-content-3">
                <label for="sky-tab3"><span><span> <i class="fa fa-angle-double-right"></i> Activities
</span></span></label>

                <input type="radio" name="sky-tabs" id="sky-tab4" class="sky-tab-content-4">
                <label for="sky-tab4"><span><span> <i class="fa fa-angle-double-right"></i> Transfers
</span></span></label>
                <input type="radio" name="sky-tabs" id="sky-tab5" class="sky-tab-content-5">
                <label for="sky-tab5"><span><span> <i class="fa fa-angle-double-right"></i> Summary
</span></span></label>
                <input type="radio" name="sky-tabs" id="sky-tab6" class="sky-tab-content-6">
                <label for="sky-tab6"><span><span> Payment
</span></span></label>

Then I have required information for each tab in rest of the section. And I have buttons like this inside each tab --

                  <div class="total_price_list_ft">
                    <a href="#">Proceed to Activities <i class="fa fa-long-arrow-right"></i></a>
                  </div>
                   <div class="total_price_list_ft_rt">
                    <a href="#"> <i class="fa fa-long-arrow-left"></i> Back to Travel Data</a>
                  </div>

How Can i implement tab change function here on button click ?

Please guide.

You can user jquery tabs check following url

http://jqueryui.com/tabs/

You can use the onclick event

href="javascript:void(0)" onclick = "$('#sky-tab2').click();

where sky-tab1,2,3, .. is the id.

You can add Tabs from JQuery UI or even considering using Bootstrap!

Bootstrap has support for tabs too. Bootstrap Javacript

Hope I helped.

You can write the JQuery Function

  $('input[name=sky-tabs]).click(function{
   #Write the code specfic to the tab here
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM