JSFiddle - React, Tailwind, and code Playground
by Luthando
HTML
<div id="content">
<input type="text" id="text1"/>
<input type="text" id="text2"/>
<input type="text" id="text3"/>
<input type="text" id="text4"/>
<input type="text" id="text5"/>
<button onclick="checker();" >Check</button>
</div>
JavaScript
function checker(){
var isEmpty= false;
$("input[type=text]").each(function() {
if($(this).val().length > 0)
{
isEmpty = true;
return false; //break out of the loop
}
});
if(!isEmpty ){
alert('atleast one of the field should be filled...');
}
}