JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="t1"/>
<input type="text" id="t2"/>
<input type="text" id="t3"/>

JavaScript

var arr = [ "t1", "t2", "t3" ];
jQuery.each(arr, function() {
      $("#"+this).val("hello");//$("#" + this).text("hello");
   });