ItSolutionStuff.com

How to Check Undefined, Empty and Null in JQuery?

By Hardik Savani January 20, 2023
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: jQuery
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube