占位符和价值同时出现 [英] Placeholder and Value Present at the Same Time
本文介绍了占位符和价值同时出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有6位数的数字(例如:123456),我想要的是输入应该出现这样的XXXX56。 XXXX是占位符,后两位数字是自动填充值。所以,当我输入第一个输入应该像1XXX56。第二键输入应该像12XX56。这是可能的吗?
解决方案
$(#phone)。inputmask({mask:999956});
< script src =https://cdnjs.cloudflare.com/ajax/libs/jquery /3.1.1/jquery.min.js\"></script><script src =https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/jquery。 inputmask.bundle.js>< / script>< form action => < DIV> < label for =phone>蒙版< / label> < input id =phonetype =text/> < / div>< / form>
I have 6 digits number(for example: 123456), what I want is the input should appear something like this XXXX56. XXXX is placeholder while last two digits is the auto-populated value. So, when i key in first input should be like 1XXX56. Second key input should be like 12XX56. It is possible?
解决方案
This will do the trick.
$("#phone").inputmask({"mask": "999956"});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/jquery.inputmask.bundle.js"></script>
<form action="">
<div>
<label for="phone">Mask</label>
<input id="phone" type="text" />
</div>
</form>
这篇关于占位符和价值同时出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文