JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/hyperscript.org@0.9.1"></script>
<form hx-post="/example" hx-target="#table tbody" hx-swap="beforeend"
>
<label class="control-label" for="nameInput">Name</label>
<input id="nameInput" name="name" class="form-control" type="text" required placeholder="John Doe"/>
<label class="control-label" for="emailInput">Email</label>
<input id="emailInput" name="email" class="form-control" type="email" required placeholder="john@doe.org"/>
<button _="on change from closest <form/>
for elt in <[required]/>
if the elt's value is empty
add @disabled then exit
end
end
remove @disabled" class="btn btn-primary" disabled>Add User</button>
</div>
</form>