<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 4 Tabs Events</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script>
$(document).ready(function(){
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e){
var activeTab = $(e.target).text();
var previousTab = $(e.relatedTarget).text();
$(".active-tab span").html(activeTab);
$(".previous-tab span").html(previousTab);
<ul id="myTab" class="nav nav-tabs">
<a href="#home" class="nav-link active" data-toggle="tab">Home</a>
<a href="#profile" class="nav-link" data-toggle="tab">Profile</a>
<a href="#messages" class="nav-link" data-toggle="tab">Messages</a>
<div class="tab-content">
<div class="tab-pane fade show active" id="home">
<h4 class="mt-2">Home tab content</h4>
<p>Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth.</p>