Monitor input box value changes in conjunction with HTML5 standard event Oninput and IE exclusive event Onpropertychange events.
H5 Mobile phone side:
<input type="text"Placeholder="Please enter the amount"Value=""oninput="Only_number (This)">//input box, limit amountfunction Only_number (obj) {//first replace the non-digital, except the number and.Obj.value = Obj.value.replace (/[^\d.) /g,""); //the first one must be guaranteed to be a number instead of.Obj.value = Obj.value.replace (/^\./g,""); //guarantee that only one appears. And not more.Obj.value = Obj.value.replace (/\.{2,}/g,"."); //guaranteed. Appears only once, and cannot occur more than two timesObj.value = Obj.value.replace (".","$#$"). Replace (/\./g,""). Replace ("$#$",".");}
Source:
Http://www.cnblogs.com/lhb25/archive/2012/11/30/oninput-and-onpropertychange-event-for-input.html
HTML5 the perfect solution for real-time monitoring of changes in input frame values: Oninput & Onpropertychange