js restricts the input box to only enter numbers, and only 11 digits

 oninput event plus judgment

<input type="number" oninput="if(value.length>11)value=value.slice(0,11)">

So you can enter a decimal point

 

<input type="number" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" oninput="if(value.length>11)value=value.slice(0,11)">

This is perfect, you can only enter numbers

Guess you like

Origin blog.csdn.net/joyvonlee/article/details/106999505