Bootstrap 4 Tab Persistence

Published on 10/18/2020 by Justin Williamson


I find it frustrating when tabs don't persist when reloading the page. Here's a little snippet I like to use for a simple, front-end solution to this problem.

The only downside is the amount of back button clicks it takes to get to the previous page due to the hash manipulation. I usually try to add some sort of 'go back' button to circumvent this issue.

Nothing special; just quick and dirty. It's all about the id naming conventions.

You might also enjoy...

Fabric.js 2.0 breakWords Implementation

Scale and Center Images with Imagemagick

jQuery DataTables Column Totals that Update with Filtering