How to Check Undefined, Empty and Null in JQuery?

By Hardik Savani January 20, 2023 Category : Javascript jQuery

If you are working on jquery and However you want to check variable is undefined or not then you can easily check by typeof operator, which is simple, fast and cross-platform:

if(typeof i == "undefined"){

alert('undefined');

}

If you are working on jquery and However you want to check variable is empty or not then you can easily check by compare with empty string:

if(i == ''){

alert('Empty');

}

If you are working on jquery and However you want to check variable is null or not then you can easily check by compare with "null":

if(i == null || i == NULL){

alert('null');

}

Try this......

Tags :
Shares