Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
<input type="tel" name="" id="" value="" placeholder="请输入11位手机号码" class="tel" maxlength="13"/>
$('.tel').on('input',function(){
var tel=$(this);
if(tel.val().length == 3 || tel.val().length == 8){
var str = tel.val()+" ";
tel.val(str);
}
});
effect: