input number 类型输入中文 光标异常


input number 类型输入中文 光标异常
const input=document.querySelector('input[type=number]');
if(input){
    input.oninput=(e)=>{
        if(e.data===''&&e.target.value===''){
            e.target.value='0'
            setTimeout(()=>{
                e.target.value=''
            },0)
        }
    }
}
posted @ 2023-09-04 16:32  7c89  阅读(49)  评论(0编辑  收藏  举报