javascriptjqueryjquery-mask

How to hide the brackets and hypens in jquery mask on focus


I dont want to display the brackets and hypens in my input field on focus. Jquery mask is defaulting it to the format which ever i am giving. How to hide that default property i.e. () and -., but on blur the brackets and hypens should get displayed.

Tried:

<input id="ssn"/>
$("#ssn").mask("(999)-999-9999");

Demo Link:

URL


Solution

  • Will this help you out?

    $('#ssn').blur(function() {
       $(this).mask("(999)-999-9999");
    });