How to mask input on Blackberry browser

277 Views Asked by At

I am using a jQuery Masked Input plugin to force the user to type the phone number in proper format.

$(document).ready(function () {
        $("#PhoneNumber").mask("(999)999-9999");
});

The problem I am having is that the Masked Input plugin does not work on blackberry browsers.

I have tried using:

Does anyone know how I can get it to work on a blackberry browser.

I am also welcome to other methods / plugins that would give me similar functionality. (As long as it works on a blackberry browser)

Any help would be appreciated.

2

There are 2 best solutions below

0
On BEST ANSWER

After searching around, I came accross Mask JSAPI library. As it turns out, this does exactly what I needed it to do and it works on a blackberry browser.

So to answer my own question, I ended up using the Mask JSAPI library and used it like this:

<script type="text/javascript">
    $(document).ready(function () {
        document.frmReferral.reset();
        oStringMask = new Mask("(###) ###-####");
        oStringMask.attach(document.frmReferral.PhoneNumber);
    });
</script>
1
On
this: ^\([0-9]{3}\)[0-9]{3}\-[0-9]{4}$ regular expression pattern matches: (999)999-9999
so you could use it to validate the input like this:

$('input:text').val().match(/^\([0-9]{3}\)[0-9]{3}\-[0-9]{4}$/);