Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js number validation

 if (value.match(/^[0-9]*$/)){
//code here
}
Comment

Number Validation in JavaScript

<html>
<body>
<script type='text/javascript'>
function onlyNumberValidation()
{
var numbers = /^[0-9]+$/;
if(document.getElementById('txtletter').value.match(letterAndNumberValue))
{
alert("Yes you enter numbers only.");
return true;
}
else
{
alert('Only numbers are allowed');
txtletter.focus();
return false;
}
}
</script>
<form>
Enter Value: <input type='text' id='txtletter'/>
<input type='button' id="btnSubmit" onclick="onlyNumberValidation()" value='Submit' />
</form>
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: useHistory react-router-dom 
Javascript :: get element by tag name 
Javascript :: node js run bat file 
Javascript :: cross-origin request blocked the same origin policy disallows reading the remote resource fix in node js node js 
Javascript :: ref to another page and achor 
Javascript :: file input change event not firing angular 
Javascript :: class with attribute selector jquery 
Javascript :: jquery remove click event 
Javascript :: JS get min date 
Javascript :: javascript object array iteration 
Javascript :: js array sort 
Javascript :: file extension regex javascript 
Javascript :: javascript setattribute 
Javascript :: open new tab with angular router 
Javascript :: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 
Javascript :: exit extension from chrome javascript 
Javascript :: committing only some changes to git 
Javascript :: electron getPath 
Javascript :: js docstring example 
Javascript :: get pods running on a node 
Javascript :: angular cli path environment variable 
Javascript :: repeat react component n times 
Javascript :: check if file is empty javascript fs 
Javascript :: install gulp ubuntu 20.04 
Javascript :: ionic angular change page route 
Javascript :: padstart and padend javascript 
Javascript :: get element by 
Javascript :: flatlist react native 
Javascript :: joi schema for confirm password 
Javascript :: Javascript find element with focus 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =