How to judge empty string in jquery

coldplay.xixi
Release: 2020-12-01 15:43:12
Original
2837 people have browsed it

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){ //代码 }
Copy after login

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

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!