Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="//code.jquery.com/jquery-1.10.2.js"></script>
- <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
- .............codes.............
- <script type="text/javascript">
- $('.alph').keypress(function (e) {
- var regex = new RegExp("^[a-zA-Zs]+$");
- var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
- if (regex.test(str)) {
- return true;
- }
- else {
- e.preventDefault();
- alert('Alphabets only');
- return false;
- }
- });
- </script>
- .............codes.............
- <asp:TextBox ID="txt_name" CssClass="alph" BorderColor="Gray" Font-Size="Large" Height="25" Width="250" runat="server"></asp:TextBox>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement