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

We Are Recommending You

JQuery Remove All Numbers from String Example

Read Now →

How to Download File using JQuery?

Read Now →

How to use Laravel Variable in JQuery?

Read Now →

Laravel JQuery UI Autocomplete Ajax Search Example

Read Now →

How to Remove Last Element from Array in JQuery?

Read Now →

Preview an image before Upload using jQuery Example

Read Now →

JQuery Delete Confirm Modal using Bootbox Example

Read Now →

How to access PHP variables in JQuery?

Read Now →

How to Allow Only One Checkbox Checked at a Time in JQuery?

Read Now →

How to Convert Line Breaks to br in jQuery ?

Read Now →

How to Check Object is Empty or Not in JQuery?

Read Now →