HTML/input
来自康健生活
< HTML
引言
方法
oninput
<input type="number" oninput="(e) => {
let value = e?.target?.value || '';
if (!(/^[0-9]+$/).test(value)) value = value.replace(/\D/g, '');
if(value > 100) value = 100;
if(value < 0) value = null;
e.target.value = value;
}" />
自动填充
input 自动填充时背景色的颜色变更:
// input 输入框,自动填充颜色问题
.ant-input:-webkit-autofill,
.ant-input:-webkit-autofill:hover,
.ant-input:-webkit-autofill:focus,
.ant-input:-webkit-autofill:active {
-webkit-transition-delay: 111111s;
-webkit-transition: color 11111s ease-out, background-color 111111s ease-out;
box-shadow: 0 0 0px 1000px #131417 inset !important;
}
No categories