我想对输入使用掩码,SP
并以PT
. 输入PT
工作正常,但SP
没有。请注意,这不是我的真实代码,它只是一个示例。
$('#partshort').mask('SP-00000000000');
$('#svpshort').mask('PT-00000000000');
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="http://igorescobar.github.io/jQuery-Mask-Plugin/js/jquery.mask.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<div class="container">
<h3>Problems with jQuery Mask Plugin?</h3>
<p>Exemplify your problem here :-)</p>
<hr />
<form role="form">
<div class="form-group">
<label for="date-field">Example 1</label>
<input type="text" class="form-control" id="partshort">
</div>
<div class="form-group">
<label for="ip-field">Example 2</label>
<input type="text" class="form-control" id="svpshort">
</div>
</form>
</div>
这是示例:http: //jsfiddle.net/1wjbysnm/