JSFiddle - React, Tailwind, and code Playground
HTML
<ul id = "qualquer">
<li id = "listitem1">
</li>
<li id = "listitem2">
</li>
<li id = "listitem3">
</li>
</ul>
JavaScript
//adding the id middle_item to the li with the id listitem1
$("#listitem1").attr("id","middle_item")
//imagine at this point you dont know which li has the id middle_item
var i = $("middle_item").id;
alert(i);