$ ( "# AccountNum"). KeyDown ( function (E) { IF (! IsNaN ( the this .value.replace (/ [] / G, "" ))) { the this .Value = the this .value.replace (/ \ . S / G, '') Replace (/ (\. 4 {D}) (? = \ D) / G, "$. 1"); // four digits group, separated by spaces } the else { IF (E. ==. 8 the keyCode) { // when illegal character input, in addition to prohibiting backspace key input return to true ; }else{ return false } } });