How to mark the page where is bootstrap 4?

I would like to know about the title .. I have this code

  

`

with this script

$ (& # 39; li a & # 39;). click (function (e) {
//e.preventDefault ();
var $ this = $ (this);
$ this.closest (& # 39; ul). find (& # 39; li.active, a.active & # 39;). removeClass (& # 39; active);
$ this.addClass (& # 39; active & # 39;);
$ this.parent (). addClass (& # 39; active);
});

but when it is time to give it to another box, only the register is kept active and not the one that is actually seen when it is clicked in another box, the record is disabled and "this other box" is activated but it instantly becomes active. The registration and deactivation of the other I do not know if I explain well .. I am new in this area I hope you m me. help and forgive the inconvenience