0

I have a button in my index page when clicking on that button I need to open a specific tab section of another page. the button is on one page and the tab is on the second page.

I have multiple tabs on the 2nd page but only writing here 1 tabs that one I need to open when is clicked from home page

Page 1 - Where I have a button

<p><a href="{{url('guide-specs').'#w1'}}" class="btn btn_readmore2">View Example Worksheet</a></p>

Page 2 - tabs exist

<ul class="nav nav-tabs">
  <li class="nav-item">
    <a class="nav-link " data-toggle="tab" href="#w1">Worksheet</a>
  </li>
  <div id="w1" class="container tab-pane fade"><br>
    <div class="container">
      <div class="row">
        <div class="col-12 col-sm-11">
          <p class="f-15 gry2">The primary use of this worksheet is to provide a detailed checklist that will facilitate precise development of specifications with drawings, to ensure that all parties are talking about the same type and quality of building.</p>
          <p>
        </div>
      </div>
    </div>
  </div>
Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58
  • Are you using jquery ui for your tabs? if so, I think you can just use the hash reference in the url, if not then you may need to set the active tab in the options https://api.jqueryui.com/tabs/ – Pete Jul 12 '19 at 11:31
  • i am using bootstrapp 4 so everything is done by bootstrap and jquery. i passed #reference but it didn't work – Abdullah Faraz Jul 12 '19 at 11:37
  • This may help: https://stackoverflow.com/questions/43068221/bootstrap-4-link-to-specific-tab (probably better using the answer with 5 votes). – Pete Jul 12 '19 at 11:39
  • 1
    absolutely it works like a charm @Pete – Abdullah Faraz Jul 12 '19 at 11:56

1 Answers1

0

Firstly this is not right way for tabs UI.

But if you want use

  <script>
$(document).ready(function(){
  $(".btn_readmore2").click(function(){
    $("#w1").load("demo_test.txt");
  });
});
</script>

other way find function is useful with is visible option you can check.

if($("#w1:visible")){ write you show action code here }

Nagnath Mungade
  • 921
  • 10
  • 11