JSFiddle - React, Tailwind, and code Playground

HTML

<span for="field1" class="field-error"> There is an error in the field 1 </span><br>
<span for="field2" class="field-error"> There is an error in the field 2 </span><br>
<span for="field3" class="field-error"> There is an error in the field 3 </span><br>

JavaScript

$('span[for="field2"]').text('This is the new error message for field 2');