JSFiddle - React, Tailwind, and code Playground

HTML

<div id="box1">Box1</div>
<div id="box2">Box2</div>
<div id="box3">Box3</div>

<button>Click here</button>

CSS

.highlight{
    background:yellow;
    color:black;
	border: 2px solid;
}

JavaScript

$('button').on('click',function(){
    //for url request uncomment below line
//var hashes =location.hash.split('#');
    //comment below line for url request
    var hashString="#box1#box2#box3";
    var hashes =hashString.split('#');
     hashes.reverse().pop();
     $.each(hashes , function (i, id) {
        $('#'+id).addClass('highlight');
       });

});