JSFiddle - React, Tailwind, and code Playground

by techunter

HTML

<input type="button" id="run" value="run" />
<div class="formDiv">
    <input name="inp1" type="text" />
    <input name="inp2" type="text" />
</div>
<div class="formDiv">
    <input name="inp3" type="text" />
    <input name="inp4" type="text" />
</div>

JavaScript

var run = function() {
    $('.formDiv').each(function () {
        var $form = $(this);
        $form.find('input').each(function () {
            $(this).val($(this).attr('name'));
        });
    });
}

$('#run').click(run);