JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<input type='text' class='inputBox' /><br/>
<textarea class='inputBox'></textarea><br/>
</div>
<button id='show'>Show</button>
JavaScript
$(document).ready(function() {
$('#show').click(function() {
var total = 0;
$('div .inputBox').each(function() {
total += this.value.length;
});
if (total == 0) {
// Do whatever if it's empty
} else {
alert(total);
// Do whatever if its not
}
});
});