Please tell me how to restrice user to enter only + and 0 to 9 numbers only. Other characters should be blocked. Also restricted characters shouldnt be pasted too.
Characters are :
PLUS
0 to 9 Number
Hi EmadKhan,
Refer the below code.
HTML
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <input name="TextBox3" type="text" id="TextBox3" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> $(function () { $("[id*=TextBox3]").on("keyup", function () { var text = $(this).val(); if (isNaN(text)) { text = text.replace(/[^0-9\+]/g, ''); } $(this).val(text); }); }); </script> </div> </form> </body> </html>
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.