Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何限制用户在以下输入中删除 1.?
<input type="text"value="1.demomomo">
您可以检查零索引处的值,如果不是 1 则添加
$('#txt1').keyup(function(){ if($(this).val()[0] !=1) $(this).val(1+$(this).val()); })