JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" class="foo" value="foo">
<input type="text" class="foo" value="foo">
<input type="text" class="foo" value="foo">
<button onclick="myfunc()">Send</button>
JavaScript
function myfunc() {
var myElementArray = document.querySelectorAll('.foo');
var myOutputText = "";
for(var i=0;i< myElementArray.length; i++){
myOutputText += myElementArray[i].value + " | ";
}
alert(myOutputText);
}