Home >Web Front-end >JS Tutorial >How to judge empty string in jquery

How to judge empty string in jquery

coldplay.xixi
coldplay.xixiOriginal
2020-12-01 15:43:122993browse

The method of judging the empty string in jquery: 1. Judge by judging whether the length of the string is 0; 2. Judge by judging whether the string is equal to null, undefined, etc. The code is [if(str ==null||str==undefined||str=="")].

How to judge empty string in jquery

The operating environment of this tutorial: windows7 system, jquery3.2.1 version. This method is suitable for all brands of computers.

How to judge the empty string in jquery:

1. By judging whether the length of the string is 0

 if(str.length==0){
//代码
}

2. By Determine whether the string is equal to null, undefined, etc.

if(str==null||str==undefined||str==""){
//代码
}

Related free learning recommendations: javascript (video)

The above is the detailed content of How to judge empty string in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more