JSFiddle - React, Tailwind, and code Playground
HTML
<div class="testdiv">
<!--put js code here -->
</div>
<div class="testdiv">do not put js here</div>
<div class="testdiv">do not put js here</div>
<div class="testdiv">do not put js here</div>
<div class="testdiv">do not put js here</div>
<div class="testdiv">do not put js here</div>
CSS
.testdiv{
border:1px solid #585858;
margin:5px;padding:5px;
}
JavaScript
var codeString ="aaa";
$('.testdiv:first').css({
'border':'2px solid #ff0000',
});
$(codeString).appendTo('.testdiv');