1、原生js写法
rush:js;">
!function () {
document.getElementById('bankCard').onkeyup = function (event) {
var v = this.value;
if(/\S{5}/.test(v)){
this.value = v.replace(/\s/g,'').replace(/(.{4})/g,"$1 ");
}
};
}();
2、jQuery写法
rush:js;">
<Meta charset="UTF-8">