Advertisement
Guest User

Untitled

a guest
Dec 25th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  2.  
  3. <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
  4. .............codes.............
  5.  
  6. <script type="text/javascript">
  7. $('.alph').keypress(function (e) {
  8. var regex = new RegExp("^[a-zA-Zs]+$");
  9. var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
  10. if (regex.test(str)) {
  11. return true;
  12. }
  13. else {
  14. e.preventDefault();
  15. alert('Alphabets only');
  16. return false;
  17. }
  18. });
  19. </script>
  20. .............codes.............
  21.  
  22. <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