You can do this like this:
let something = document.getElementById("something");
something.addEventListener('click', function(){
something.id = 'something2'
console.log(something);
});
<a id="something">something</a>
let me know if this work for you.