I use RobinHerbots/Inputmask to mask an input field. Placeholder displays fine. But when I start to type in the input field delimiters disappear and the text is unmasked.
$(function() {
$('#my_id').inputmask("**-**-****-****",
{placeholder:"X",
clearMaskOnLostFocus: false });
});
<input type="text" id="my_id" />
https://jsfiddle.net/xnedg7wo/
How to make the dashes stay?
Thank you!
You are using the GitHub URLs for the latest 4.x script sources... And I see a commit 4 days ago here. I can't tell if that is directly related. But why not use the stable 3.3.4 bundle avalaible on cdnjs?
$(function() {
$('#my_id').inputmask("**-**-****-****",{
placeholder:"X",
clearMaskOnLostFocus: false
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script>
<input type="text" id="my_id" />