locked
masked textbox "1-9999999" RRS feed

  • Question

  • User-1212693777 posted

    I am trying to implement a mask on a textbox that forces the user to follow the format "1-9999999", where the "1-" will always be at the beginning, and they can only enter 7 numbers after that.  I added the masked edit extender, along with the script manager, and put the mask "1-9999999", but it isn't recognizing it at all.  Do master pages affect using the ajax control toolkit? thanks

    Tuesday, April 15, 2014 9:02 PM

Answers

  • User2103319870 posted

    You can take a look at the Masked Textbox Jquery plug in - DigitalBush Masking Plug-In

    Sample Code:

    <!DOCTYPE html>
    <html>
    <head>
    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    <script src="http://digitalbush.com/wp-content/uploads/2013/01/jquery.maskedinput-1.3.1.min_.js"></script>
       
      <meta charset="utf-8">
      <title>JS Bin</title>
      <script type='text/javascript'>
        $( document ).ready(function() {
           $('#txtNumber').mask('1-9999999');
        });
      </script>
    </head>
    <body>
      <input type="text" id="txtNumber" />
    </body>
    </html>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 15, 2014 11:24 PM