Javascript input mask

Programmatically appying a mask to a string using jSuites mask.

String without mask

Mask

Result




Source code

<html>
<script src="https://bossanova.uk/jsuites/v3/jsuites.js"></script>
<link rel="stylesheet" href="https://bossanova.uk/jsuites/v3/jsuites.css" type="text/css" />

<button onclick='test()'>Parse string</button>

<script>
var test = function() {
    var text = document.getElementById('text').value;
    var mask = document.getElementById('mask').value;
    document.getElementById('result').value = jSuites.mask.run(text, mask);
}
</script>

</html>