how to check whether a input is empty in javascript code example
Example 1: how to check if all inputs are not empty with javascript
const inputFeilds = document.querySelectorAll("input");
const validInputs = Array.from(inputFeilds).filter( input => input.value !== "");
console.log(validInputs) //[array with valid inputs]
Example 2: hhow to check input is null in html using js
function required(inputtx)
{
if (inputtx.value.length == 0)
{
alert("message");
return false;
}
return true;
}