I have this setup and it works nice:
$('#PhoneNumber').inputmask({ mask: "89999999999", placeholder: "" });
It allows typing phone numbers starting with "8". But now I would like it to accept many such phone numbers delimited by a comma.
81234567890 -- rorrect
81234567890, 80987654321 -- rorrect
81234567890,80987654321 -- rorrect
81234567890, -- not correct
81234567890,, -- not correct
81234567890, 80987654321, -- not correct
...and so on...
This is the plugin I used.
You can use the regex mode with the expression ^[0-9]{8}([,.][0-9]{8})+$
:
$('#phoneNumbers').inputmask({
regex: "^[0-9]{8}([,.][0-9]{8})+$",
placeholder: ""
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://rawgit.com/RobinHerbots/jquery.inputmask/3.x/dist/jquery.inputmask.bundle.js"></script>
<input id="phoneNumbers">