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
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Check the validation which allows only didgits & hyphen
WhatsApp
Ghanashyam Nayak
4y
58.7
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
Up Next
Allow Only Numeric Values and allow Only one DOT in TEXTBOX using JavaScript
Ebook Download
View all
Frontend Developer Interview Questions and Answers
Read by 945 people
Download Now!
Learn
View all
Membership not found