TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
No Alphabet JavaScript
Abhishek Chadha
Sep 23
2015
Code
891
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
function
noAlphabet(e)
{
var
regex =
new
RegExp(
"[0-9]"
);
var
key = e.keyCode || e.which;
key = String.fromCharCode(key);
if
(!regex.test(key))
{
e.returnValue =
false
;
if
(e.preventDefault)
{
e.preventDefault();
}
}
}
<asp:TextBox ID=
"qty"
runat=
"server"
CssClass=
"form-control"
onkeypress=
"return noAlphabet(event)"
MaxLength=
"3"
></asp:TextBox>
no alphabets
JavaScript