JSFiddle - React, Tailwind, and code Playground

by rwaldron

HTML

<form id="main" action="" method="post">
    <input type="text" id="ns2" value="" /> <br />
    <input type="text" id="ns3" value="" /> <br />
    <input type="text" id="ns4" value="" /> <br />
    <input type="text" id="ns5" value="" /> <br />
    <input type="text" id="ns6" value="" /> <br />
</form>
<p>
    The go button should append "next one" inside the first empty input<br />
    <a href="#" id="go">go (non working)</a>

</p>

JavaScript

$("#go").click(function(e) {
    e.preventDefault();

    console.log($("#main input:text[value='']:first"));
        
        
    $("#main input:text[value='']:first").val("next one");
});