I want to set telephone masking(US Country telephone number format) in my customer registration form how can i do that? In US telephone number format is (999) 999-9999 now i want to in my customer registration form when i click on telephone number field then above phone number format maskin should open.please refer the screenshot

  • Please add more details
    – Jarnail S
    Sep 13, 2019 at 16:22
  • @Jai please check my updated answer Sep 13, 2019 at 16:29
  • @prashant valanda if you know please help me Sep 13, 2019 at 16:53

1 Answer 1


Please check below code you need to implement it in Magento 2.

$('#phoneNumber').inputmask("(999) 999-9999");

And then this.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://rawgit.com/RobinHerbots/jquery.inputmask/3.x/dist/jquery.inputmask.bundle.js"></script>

<label class="control-label col-sm-2">Phone Number:</label>
  <div class="col-sm-10">          
  <input type="text" class="form-control" name="phoneNumber" id="phoneNumber" value="">

Here is the Link from where I got it and here code snippets also to check.

Hope it will help you and Happy Coding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.