Home >Web Front-end >JS Tutorial >js implementation to determine whether the input box cannot be a space or null value code

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

小云云
小云云Original
2018-03-03 09:17:331256browse

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{
	}

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!

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