JSFiddle - React, Tailwind, and code Playground

HTML

<span>hey you!</span>
<input type="text" name="test" id="test" />

JavaScript

alert ("The val: " +  $('span').eq(0).val() );
alert ("The text: " +  $('span').eq(0).text() );
alert ("The text input A: " +  $('#test').val() );
alert ("The text input B: " +  $('#test').eq(0).text() );