check if field is empty javascript code example
Example 1: if input value is null do something
if(document.getElementById("question").value.length == 0)
{
alert("empty")
}
Example 2: javascript check if empty
//check if string is undefined
if (typeof myVar === 'undefined'){
console.log("I am not defined");
}
//check if string is empty, null, or 0
var emptyString="";
if (emptyString) {
console.log("im not empty");
}