C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Check the validation which allows only didgits & hyphen
WhatsApp
Ghanashyam Nayak
5y
59
k
0
0
25
Blog
<html>
<head>
<title>Sample Code</title>
<script type=
"text/javascript"
>
function
Check(b)
{
var
a = /(^[0-9]+[-]*[0-9]+$)/;
if
(a.test(b) ==
true
)
{
alert(
"Match Criteria"
)
}
else
{
alert(
"Please Enter Only Digits & Hyphen."
)
}
};
</script>
</head>
<body bgcolor=#00ff00 alink=blue vlink=blue>
<FORM name=
"windowEvent"
>
Number : <input type=
"text"
name=
"txtnumber"
/>
<input type=
"button"
value=
"Check"
name=
"btnNumber"
onClick=
"Check(txtnumber.value)"
/>
</FORM>
</body>
</html>
Check the validation which allows only didgits hyphen
Recommended related topics
Membership not found