Loading

Loading

输入框手机号分割

			const ipt = document.querySelector('#ipt')
			ipt.oninput = (e) => {
				const v = (e.target.value + '').replace(/\D/g, '')
				const r = v.replace(/^(\d{3})/, '$1-').replace(/(\d{4})/, '$1-').replace(/-$/, '')
				ipt.value = r.substr(0, 13)
			}
posted @ 2022-06-22 00:17  灰色的修饰  阅读(41)  评论(0编辑  收藏  举报