JSFiddle - React, Tailwind, and code Playground
by georeith
HTML
<div id="one">
</div>
<div id="two">
</div>
CSS
div {
background: #000;
width: 50px;
height: 50px;
}
JavaScript
var numCompare = "hello";
var data = "<div id='1'></div><input type='text' id='2'/>";
var output = $("<div></div>").html(data);
output.find("[id]").each(function() { // Select all elements with an ID
var target = $(this);
var id = target.attr("id"); // Get the ID
target.attr("id", id + "_" + numCompare); // Set the id
});
console.log(output.html());