How to disable Nav-tabs bootstrap with php

Asked

Viewed 465 times

0

I’m trying to disable some nav-tabs that I have with an action in php, but I’m having trouble executing this action completely, until I was able to disable the nav-tabs with that code class='disabled' by placing the mouse over the first two tabs the disabled icon appears, but if I click on it it shows me the content. I’m making a select to seek some mandatory stages that the contract must possess, if the result is greater than zero the first two tabs must be enabled and show the forms which exist there, otherwise, if the value is zero the first two tabsmust be disabled because the contract can only be completed if the Mandatory Phases are registered.

What I got is this:

<div class="tabbable well" id="tabs-648642">

  <ul class="nav nav-tabs">
    <li <?php if ( $totalRows_FaseObrigatoriaTab > 0 ) { echo "class='enable'"; } else { echo "class='disabled'"; } ?> > <a href="#panel-1" data-toggle="tab">Fases</a> </li>
    <li <?php if ( $totalRows_FaseObrigatoriaTab > 0 ) { echo "class='enable'"; } else { echo "class='disabled'"; } ?> > <a href="#panel-2" data-toggle="tab">Doctos</a> </li>
<li> <a href="#panel-3" data-toggle="tab">Fases Obrigatórias</a> </li>
  </ul>

  <div class="tab-content"> 

    <div class="tab-pane active" id="panel-1"></div>

    <div class="tab-pane" id="panel-2"></div>

    <div class="tab-pane" id="panel-3"></div>

</div>

</div>

I’m deleting the codes from nav-tabs for easy viewing.

  • Don’t use Stacksnippet unnecessarily, it is obviously used to play html,css,js code and in your code there is php, which of course will not work. LEIA: https://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/ - Please take this as a constructive review ;)

  • Hello @Guilherme Nascimento, thank you for the tip, no problem at all, was marked my own.

No answers

Browser other questions tagged

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