Search code examples
jqueryasp.nettelerikjquery-inputmask

How to mask a decimal input using Jquery?


I have previously used Telerik's RadNumericTextBox for giving input of decimals like below:

<telerik:RadNumericTextBox ID="txtNewAmt" runat="server" EnableViewState="false"
           Width="100px" CssClass="input" Type="Number" EnabledStyle-HorizontalAlign="Right"
           PlacesBeforeDecimal="11" NumberFormat-DecimalDigits="2">
      <ClientEvents OnKeyPress="validateRegExMaskNumeric" />
</telerik:RadNumericTextBox>

Here, in the input,

  1. Only numbers are allowed.
  2. Numbers will be aligned from right.
  3. Places before decimal can be 11 or less and after decimal can be 2 or less.

But, i don't want to use Telerik anymore.

How to mask the same thing using Jquery? Can it be handled using asp:Textbox?


Solution

  • I have to choose between jQuery Mask Plugin and MaskInput Plugin. jQuery Mask Plguin is bulkier than MaskInput as it contains more features. But, for my need, i chose MaskInput Plugin.

    You can find some examples here and my experience here.