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!