Home > Web Front-end > JS Tutorial > body text

js implementation to determine whether the input box cannot be a space or null value code

小云云
Release: 2018-03-03 09:17:33
Original
1232 people have browsed it

This article mainly shares with you the code to implement js to determine that the input box cannot be a space or null value. It has a good reference value and I hope it can help 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

Related recommendations:

h5How to implement input box prompts + normal text box prompts

AngularJS implements the input box word limit reminder function

JavaScript implements the input box editor syntax highlighting ideas and code details

The above is the detailed content of js implementation to determine whether the input box cannot be a space or null value code. 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