0

I have an asp:button on my web page. Can I apply JQuery input mask on my asp.net button. Below is what I did:

I installed

Install-Package jQuery.InputMask -Version 5.0.2

I have this on my page in Head tag:

<script src="Scripts/inputmask/inputmask.js"></script>  

On my web page, I have Phone number field:

<asp:TextBox ID="txtPhonenumber" runat="server" placeholder="(XXX) XXX-XXXX"></asp:TextBox>

I want to apply input mask of phone number on my webform if possible.

1
  • Are you facing any probelm? Commented Jun 20, 2020 at 16:17

1 Answer 1

1
<asp:TextBox ID="txtPhonenumber" runat="server"></asp:TextBox>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $("#<%= txtPhonenumber.ClientID %>").mask("(999) 9999-9999?9");
            });
  </script>

Output here:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.