Project case requirements, such as input/binding the correct mobile phone number to download software, enter the mobile phone number to send verification code functions, etc.;
The following code can implement the basic functionality:
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "Utf-8"> <style>. Gray-btn{background:#ccc; }. Blue-btn{background:#09f; } </style></Head><Body><inputtype= "Tel"name= "mobile"ID= "Getnum"value=""placeholder= "Fill in mobile phone number"AutoComplete= ' Off '/><inputtype= "button"name= "button"class= "Gray-btn downloadbtn"value= "Go to download **app"Disabled/><Scriptsrc= "Jquery-1.7.2.min.js"></Script><Script> //Monitor input phone number$ (document). On ('input PropertyChange','#getNum',function(e) {if(E.type=== "input" ||E.orignalevent.propertyname=== "value") { if( This. Value.length== One){ varMyreg= /^1\d{10}$/; if(!Myreg.test ( This. Value)) {common.tips ({msg:'Please enter the correct phone number'}); return; } $('. Downloadbtn'). Removeclass ('gray-btn'). addclass ('blue-btn'); $('. Downloadbtn'). attr ("Disabled", false); }Else{ $('. Downloadbtn'). addclass ('gray-btn'). Removeclass ('blue-btn'); $('. Downloadbtn'). attr ("Disabled", true); } } })</Script></Body></HTML>
Mobile monitor input phone number and determine the mobile phone number is valid