Tabs causing the dropdown to close

Asked

Viewed 35 times

0

Someone can help me, I put the tabs inside a dropdown and when I change the tab the dropdown closes.

 Login Login Novo Login Antigo

        <div class="tab-content">
          <div role="tabpanel" class="tab-pane active" id="novo">
            <div class="input-group">
              <span class="input-group-addon" id="basic-addon1"><i class="fa fa-user" aria-hidden="true"></i></span>
              <input type="text" class="form-control" placeholder="usuario@apelido" aria-describedby="basic-addon1">
            </div>
            <div class="input-group">
              <span class="input-group-addon" id="basic-addon1"><i class="fa fa-lock" aria-hidden="true"></i></span>
              <input type="password" class="form-control" placeholder="Senha" aria-describedby="basic-addon1">
            </div>
            <button type="button" class="btn btn-primary" aria-haspopup="true">Acessar</button>
            <p><i class="fa fa-lock" aria-hidden="true"></i> &nbsp;<a href="#">Esqueci minha senha</a></p>
          </div>
          <div role="tabpanel" class="tab-pane" id="antigo">
            <div class="input-group">
              <span class="input-group-addon" id="basic-addon1"><i class="fa fa-user" aria-hidden="true"></i></span>
              <input type="text" class="form-control" placeholder="Código do Cliente" aria-describedby="basic-addon1">
            </div>
            <div class="input-group">
              <span class="input-group-addon" id="basic-addon1"><i class="fa fa-lock" aria-hidden="true"></i></span>
              <input type="password" class="form-control" placeholder="Senha" aria-describedby="basic-addon1">
            </div>
            <button type="button" class="btn btn-primary" aria-haspopup="true">Acessar</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</article>
  • Describe a little more about your code, post CSS and JS that complements.

1 answer

0


solved with javascript code

$('.dropdown-menu a[data-toggle="tab"]').click(function(e) {
    e.stopPropagation()
    $(this).tab('show')
})

Browser other questions tagged

You are not signed in. Login or sign up in order to post.