JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="foo"></textarea>
<br/>
<input id="bar" value="" type="text" />
<br/>
<input id="check" value="test" type="button" />
<br/>
<span id="res"></span>
JavaScript
$(function () {
$('#foo, #bar').on("keyup paste", function () {
$(this).attr('value', $(this).val());
})
$('#check').on('click', function () {
$('#res').html("textarea vide => " + $("#foo[value='']").length + "<br/>input vide => " + $("#bar[value='']").length);
});
})