How to link button to another page referring to specific tab?

I had a list of tab on view_profil page:

 <div class="panel panel-default">
<ul class="nav nav-pills" id="mytab">
  <li class="active"><a data-toggle="tab" href="#profil">Profil</a></li>
  <li><a id="keluarga-tab" data-toggle="tab" href="#keluarga">Keluarga</a></li>
  <li><a id="kursus-tab" data-toggle="tab" href="#kursus">Kursus</a></li>
  <li><a id="akademik-tab" data-toggle="tab" href="#akademik">Akademik</a></li>
  <li><a id="anugerah-tab" data-toggle="tab" href="#anugerah">Anugerah</a></li>
</ul>

I want to link a button from other page to this page but referring to 'keluarga' tab directly.

I used this code for the button:

<a href="{{ url('/view_profil/' . $valueItemregistrationkeluarga->ItemRegistrationID.'#keluarga') }}" class="btn btn-warning btn-md">Back</a>

I had tried using a few jquery code and javascript but fail..What is the right javascript/jquery for this purpose?

I am using laravel 5 for this application.

Sorry madalinivascu, I am not eligible to comment for now..so I post here.. The output link of your suggestion answer is 'http://127.0.0.1:8000/view_profil3/#keluarga' and page not found.

1 answer

  • answered 2018-11-08 08:35 madalinivascu

    Use the following link

    <a href="{{ url('/view_profil/').$valueItemregistrationkeluarga->ItemRegistrationID}}/#keluarga" class="btn btn-warning btn-md">Back</a>