Masking option in AEM form fields



I am trying to mask a form field which has SSN. Once the user tabs out of the field it should display xxx-xx-1234. I have looked into patterns option but I think that helps only to format the field. Is there any option to provide the masking format as well similar to pattern or do I need to write javascript for that ?