'How to redirect to a specific tab using Laravel
I am using the Laravel application for my project where I have 3 different tabs in a view.
The tabs on view file-
<a class="nav-link active" data-toggle="pill" href="#tab1">tab1 </a>
<a class="nav-link" data-toggle="pill" href="#tab2">tab2</a>
<a class="nav-link" data-toggle="pill" href="#tab3">tab3</a>
Now, I have a form and I want to redirect to a specific tab after submitting it.
In Controller, I am returning like this-
return redirect()->route('home')->with('message','sucessfull');
Now, I don't know how to redirect to a specific tab. Can you please help me to know it?
Solution 1:[1]
To redirect to a specific tab, you have to use URL hash.
For Tab 1-
return redirect(route('home').'#tab1')->with('message','sucessfull');
For Tab 2-
return redirect(route('home').'#tab2')->with('message','sucessfull');
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shrey |
