Change tabs via Modal bootstrap

1

Thanks to our colleague DontVoteMeDown, I can change button tabs through this solution tabs with jquery . But when I try to change the tabs for Bootstrap modal, I can not. I have the following code:

  $(function() {
    $( "#tabs" ).tabs();

    $("#Sim").on("click", function() 
            {
          $( "#tabs" ).tabs();
          var indice = $('#tabs ul li a[href="#' + $(this).parent().prop("id") + '"]').parent().index();
          $("#tabs").tabs("option", "active", (indice + 1));
    });

("#Sim") is the Id of the button, that is, by Modal I ask if he wants to register another service, if he clicked Yes, it was to go to another tab:

<button type="button" class="btn btn-primary" id="Sim" data-dismiss="modal">Sim</button>
    
asked by anonymous 16.10.2015 / 15:47

1 answer

1

I managed to resolve. The solution was as follows. The structure of the tabs is as follows:

 <div id="tabs">
  <ul>
    <li><a href="#tabs-1">Aba 1</a></li>
    <li><a href="#tabs-2">Aba 2</a></li>
    <li><a href="#tabs-3">Aba 3</a></li>    
    <li><a href="#tabs-4">Aba 4</a></li>
  </ul>

When I click the Yes button I put the following code:

 $("#Sim").on("click", function() 
            {  
        var novaURL = "index.php?#tabs-2";
        $(window.document.location).attr('href',novaURL);    
});

Please note that I have # tabs-2 for Aba 2 , and so on.     .....

    
16.10.2015 / 17:31