Navigation tab doesn't change with click in bootstrap


Man · ((Peyman Omidi)

I've created two tabs for "Fixtures" and "Results", but when I click on the "Results" tab, nothing changes and it remains in the "Fixtures" tab! Here is my code:

<section>
    <div class="container">
      <div class="row">
          <div class="col-lg-12">

            <ul id="myTab" class="nav nav-tabs nav-justified">
                <li class="active"><a href="#service-one" data-toggle="tab">Fixtures</a>
                </li>
                <li class=""><a href="#service-two" data-toggle="tab">Results</a>
                </li>
            </ul>

            <div id="myTabContent" class="tab-content">

                <div class="tab-pane fade active in" id="service-one">
                    <table class="table table-condensed table-hover">
                        <tbody>
                          <tr>
                            <td class="col-md-2"><img src="img/leagues/bpl-s.png" alt="bpl" class="img-rounded"></td>
                            <td class="col-md-2">Manchester United</td>
                            <td class="col-md-1">vs</td>
                            <td class="col-md-2">Tottenham</td>
                            <td class="col-md-2">12:45</td>
                          </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="myTabContent" class="tab-content">
                <div class="tab-pane fade in" id="service-two">
                    <table class="table table-condensed table-hover">
                        <tbody>
                          <tr>
                            <td class="col-md-2"><img src="img/leagues/bpl-s.png" alt="bpl" class="img-rounded"></td>
                            <td class="col-md-2">Manchester United</td>
                            <td class="col-md-1">5-2</td>
                            <td class="col-md-2">Tottenham</td>
                            <td class="col-md-2">Report</td>
                          </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
      </div>
  </div>

How can I fix this to switch between tabs and display their content?

dhiraj

You place and #service-onein #service-twotwo different tab content. That's why it doesn't work.

put it in#myTabContent

<ul class="nav nav-tabs nav-justified" id="myTab">
    <li class="active">
        <a data-toggle="tab" href="#service-one">Fixtures</a>
    </li>

    <li class="">
        <a data-toggle="tab" href="#service-two">Results</a>
    </li>
</ul>

<div class="tab-content" id="myTabContent">
    <div class="tab-pane fade active in" id="service-one">
        .....
    </div>

    <div class="tab-pane fade in" id="service-two">
        .....
    </div>
</div>

Here is a demo

Related


Navigation tab doesn't change with click in bootstrap

Man · ((Peyman Omidi) I've created two tabs for "Fixtures" and "Results", but when I click on the "Results" tab, nothing changes and it remains in the "Fixtures" tab! Here is my code: <section> <div class="container"> <div class="row"> <div

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Bootstrap affix doesn't change active tab

xx The code was written by a former front-end developer at my company. After he left, I was asked to edit this page. When I was done working on the CSS, I found that the affixes that were valid before would always activate the last li element. I have tried man

Bootstrap affix doesn't change active tab

xx The code was written by a former front-end developer at my company. After he left, I was asked to edit this page. When I was done working on the CSS, I found that the affixes that were valid before would always activate the last li element. I have tried man

Bootstrap affix doesn't change active tab

xx The code was written by a former front-end developer at my company. After he left, I was asked to edit this page. When I was done working on the CSS, I found that the affixes that were valid before would always activate the last li element. I have tried man

Bootstrap affix doesn't change active tab

kxxoling The code was written by a former front-end developer at my company. After he left, I was asked to edit this page. When I was done working on the CSS, I found that the affix that worked before would always activate the last li element. I have tried man

Bootstrap affix doesn't change active tab

kxxoling The code was written by a former front-end developer at my company. After he left, I was asked to edit this page. When I was done working on the CSS, I found that the affix that worked before would always activate the last li element. I have tried man

Bootstrap data-toggle="tab" change/JQuery doesn't recognize/click

and I have Bootstrap navset up nav-pillsand trying to capture every time a tab is clicked using JQuery. I can't identify each click using a JQuery function. I have a JSFiddle of the code I'm using, but can't get it alertor console.logtrigger it - nothing comes

Bootstrap data-toggle="tab" change/JQuery doesn't recognize/click

and I have Bootstrap navset up nav-pillsand trying to capture every time a tab is clicked using JQuery. I can't identify each click using a JQuery function. I have a JSFiddle of the code I'm using, but can't get it alertor console.logtrigger it - nothing comes

Bootstrap data-toggle="tab" change/JQuery doesn't recognize/click

and I have Bootstrap navset up nav-pillsand trying to capture every time a tab is clicked using JQuery. I can't identify each click using a JQuery function. I have a JSFiddle of the code I'm using, but can't get it alertor console.logtrigger it - nothing comes

Bootstrap data-toggle="tab" change/JQuery doesn't recognize/click

and I have Bootstrap navset up nav-pillsand trying to capture every time a tab is clicked using JQuery. I can't identify each click using a JQuery function. I have a JSFiddle of the code I'm using, but can't get it alertor console.logtrigger it - nothing comes

Bootstrap data-toggle="tab" change/JQuery doesn't recognize/click

and I have Bootstrap navset up nav-pillsand trying to capture every time a tab is clicked using JQuery. I can't identify each click using a JQuery function. I have a JSFiddle of the code I'm using, but can't get it alertor console.logtrigger it - nothing comes

Bootstrap data-toggle="tab" change/JQuery doesn't recognize/click

and I have Bootstrap navset up nav-pillsand trying to capture every time a tab is clicked using JQuery. I can't identify each click using a JQuery function. I have a JSFiddle of the code I'm using, but can't get it alertor console.logtrigger it - nothing comes

Bootstrap data-toggle="tab" change/JQuery doesn't recognize/click

and I have Bootstrap navset up nav-pillsand trying to capture every time a tab is clicked using JQuery. I can't identify each click using a JQuery function. I have a JSFiddle of the code I'm using, but can't get it alertor console.logtrigger it - nothing comes

Show Bootstrap tab loaded with Ajax on first click doesn't work

dirty encoder I am trying to load the content of a given tab using Ajax. I'm rendering the first tab active on the server, and the other tabs are active and loaded using Ajax. The problem I've isolated (without Ajax) is here . HTML: <h1>Hello, tabs!</h1> <div

Show Bootstrap tab loaded with Ajax doesn't work on first click

dirty encoder I am trying to load the content of a given tab using Ajax. I'm rendering the first tab active on the server, and the other tabs are active and loaded using Ajax. The problem I've isolated (without Ajax) is here . HTML: <h1>Hello, tabs!</h1> <div

Safari 9 - Tab click doesn't fire change event

Blalo On Safari 9, changing a radio button via its label doesn't trigger an alert. Do you know the reason or solution? HTML <input id="star-1" type="radio" name="question[1]" value="1" required> <label for="star-1" title="stella 1"> <i class="active fa fa-

Safari 9 - Tab click doesn't fire change event

Blalo On Safari 9, changing a radio button via its label doesn't trigger an alert. Do you know the reason or solution? HTML <input id="star-1" type="radio" name="question[1]" value="1" required> <label for="star-1" title="stella 1"> <i class="active fa fa-

Safari 9 - Tab click doesn't fire change event

Blalo On Safari 9, changing a radio button via its label doesn't trigger an alert. Do you know the reason or solution? HTML <input id="star-1" type="radio" name="question[1]" value="1" required> <label for="star-1" title="stella 1"> <i class="active fa fa-

Safari 9 - Tab click doesn't fire change event

Blalo On Safari 9, changing a radio button via its label doesn't trigger an alert. Do you know the reason or solution? HTML <input id="star-1" type="radio" name="question[1]" value="1" required> <label for="star-1" title="stella 1"> <i class="active fa fa-

Safari 9 - Tab click doesn't fire change event

Blalo On Safari 9, changing a radio button via its label doesn't trigger an alert. Do you know the reason or solution? HTML <input id="star-1" type="radio" name="question[1]" value="1" required> <label for="star-1" title="stella 1"> <i class="active fa fa-

Bootstrap tab doesn't change content on multiple clicks

Abhishek Gage I've been trying to implement tabs in one of my pages. code show as below. <div class="row justify-content-between"> <div class="col-lg-3"> <a class="nav-link p-3 mb-2 sidebar-link justify-content-between text-success ml-4" href="#1"

Tab click doesn't work

rookie I tried following this demo https://www.youtube.com/watch?v=PP3x4crHBog but since I already named other tags I can't name the same thing, so I made some changes to the variable names and Using the skins and all the formatting, but whenever I click the l