JSFiddle - React, Tailwind, and code Playground
HTML
<div id="a">
</div>
<div id="b">
</div>
<div id="c">
</div>
CSS
div{
width:100px;
height:100px;
margin:25px;
}
#a{
background-color:darkred
}
#b{
background-color:teal;
}
#c{
background-color:gold;
}
JavaScript
$("div").click(function(){
let newId = $(this).attr('id');
let firstId = $('div:nth-child(1)').attr('id');
$(this).attr('id', firstId);
$('div:nth-child(1)').attr('id', newId);
});