Home > Web Front-end > JS Tutorial > How to use js to determine that the input box cannot be a space or null value?

How to use js to determine that the input box cannot be a space or null value?

亚连
Release: 2018-06-02 10:00:20
Original
2872 people have browsed it

Below I will share with you a js implementation method for judging that the input box cannot be a space or a null value. It has a good reference value and I hope it will be helpful to everyone.

The example is as follows:

 var sno = $('#sno').val();
	var sname = $('#sname').val();
	if((sno.indexOf(" ") >= 0 || sno == null) || (sname.indexOf(" ") >= 0 || sname == null)){
		alert('学号和名称不能为空格或null值');
		return;
	}else{
	}
Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to deal with display issues before vue rendering (detailed tutorial)

By using ueditor in the vue project (Detailed tutorial)

How to use superagent and cheerio using nodejs crawler

The above is the detailed content of How to use js to determine that the input box cannot be a space or null value?. 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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template