Load tab only when clicking (with jquery)

0

I'm using the tab system with jqueryUI and I came across a problem where I need to load the page, just load the first tab, is there a way to do this?

    
asked by anonymous 17.07.2018 / 22:14

1 answer

0

Basically this is what is in the example. In ABA 1 you load the content on the page itself, in the other tabs, you load a different html for each one.

$(document).ready(function() {
    $("#tabs").tabs({
      beforeLoad: function(event, ui) {
        ui.jqXHR.fail(function() {      // função se houver algum erro
          ui.panel.html(
            "Mensagens de erro caso o conteúdo não seja carregado por algum motivo" );
        });
      }
    });
});
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script><scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Tab 1</a></li>
    <li><a href="arquivoTab2.html">Tab 2</a></li>
    <li><a href="arquivoTab3.html">Tab 3</a></li>
    <li><a href="arquivoTab4.html">Tab 4</a></li>
  </ul>
  <div id="tabs-1">
    <p>TEXTO QUE JÁ VEM PRE CARREGADO QUANDO VOCÊ ACESSAR A PÁGINA.</p>
  </div>
</div>
    
19.07.2018 / 15:15