JSFiddle - React, Tailwind, and code Playground

HTML

<div id="container">

<div>
 <span>
   <input type="text" id="item1" value="AA"/>
 </span>
</div>

<div>
 <span>
   <input type="text" id="item2" value="BB"/>
 </span>
</div>

<div>
 <span>
   <input type="text" id="item3" value="CC"/>
 </span>
</div>

</div>

JavaScript

var ids = []
var values = []
$('#container input[type=text]').each(function() {
ids.push($(this).attr('id'));
values.push($(this).val())
})
alert(ids)
alert(values)