Home > Web Front-end > JS Tutorial > Commonly used Javascript data validation plug-ins_Basic knowledge

Commonly used Javascript data validation plug-ins_Basic knowledge

WBOY
Release: 2016-05-16 15:47:27
Original
1159 people have browsed it

Native Javascript phone number verification, email verification, ID card verification. When using, pass in the string to be verified, return true to indicate compliance, and return false if the code does not match.
Use:

document.getElementById("btnPhone").onclick=function(){
    alert(ValidationHandler.IsPhone(document.getElementById("phoneInput").value)==true?"合法":"不合法")
  };
  document.getElementById("btnEmail").onclick=function(){
    alert(ValidationHandler.IsEmail(document.getElementById("emailInput").value)==true?"合法":"不合法")
  };
  document.getElementById("btnIdCard").onclick=function(){
    alert(ValidationHandler.isIDCard(document.getElementById("idCardInput").value)==true?"合法":"不合法")
  };
Copy after login

Operation rendering:

The above is the entire content of this article. I hope it will be helpful for everyone to learn the Javascript data validation plug-in.

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