0

Here is the demo code:

<ul>
<li><a href="#" class="button is-checked" data-filter="*">All</a></li>
<li><a href="#" data-filter=".advertising" class="button"> ADVERTISING </a></li>  
</ul>

suppose, advertise is selected and and goes inside it. Clicking on back button sends back to All tab selected, how to get advertise selected.

I tried following codes but doesn't work

<a href="javascript:history.back(1)">Back</a>
<button type="button" onclick="history.back();">Back</button>
Anup GC
  • 742
  • 1
  • 6
  • 16

1 Answers1

0

You should send back the data-filter from the inside page to identify which tab needs to be selected.

If received .advertising data-filter then you need to add class is-checked to the respective <a> tag

Example

Inside page

<a href="mainPage.php?dataFilter=.advertising">Back</a>

don't forget to update the filename mainPage.php to your file name

Main page

<?php
    $dataFilter = $_GET['dataFilter'];
?>

<ul>
    <li><a href="#" class="button<?php echo ($dataFilter=='*' || $dataFilter=='')?" is-checked":""; ?>" data-filter="*">All</a></li>
    <li><a href="#" data-filter=".advertising" class="button<?php echo ($dataFilter=='.advertising')?" is-checked":""; ?>"> ADVERTISING </a></li>  
</ul>
Thiyagesan
  • 75
  • 6