Home >Web Front-end >JS Tutorial >Validate uppercase letters, numbers and Chinese in javascript_javascript skills

Validate uppercase letters, numbers and Chinese in javascript_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:03:471519browse
Copy code The code is as follows:

var reg = /^[u4E00-u9FA5] $/; // Verify Chinese
var cp=$("input[name='cpid']").val();
for(var i=0;ivar cpp =cp.charAt(i);
if(!reg.test(cpp)||cpp.match(/^([A-Z]) $/)||cpp.match(/^d $/)){ //Verify uppercase letters, numbers and Chinese
document.getElementById("div2").style.display="block";
document.getElementById("div2").style.color="red";
$("#div2").text("*Must enter all lowercase letters!!!");
// return false;
}
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