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

validatorjs number

const validationRule = 'required|numeric';
Comment

PREVIOUS NEXT
Code Example
Javascript :: Datatables Text Align Center 1 Or More Column 
Javascript :: js get transition duration 
Javascript :: unique values from array of objects 
Javascript :: Check if a JavaScript string is a URL 
Javascript :: change style of class divs jquery 
Javascript :: styled components error in nextjs 
Javascript :: nodejs 16 install 
Javascript :: addeventlistener keydown 
Javascript :: set data-id value jquery 
Javascript :: how to copy text in react 
Javascript :: javascript set input value by class name 
Javascript :: MIN_SAFE_INTEGER 
Javascript :: fs in angular 
Javascript :: check given path is valid or not in nodejs 
Javascript :: js canvas line end 
Javascript :: nombre random js 
Javascript :: js rounding 
Javascript :: jquery each data 
Javascript :: ajax post 
Javascript :: remove last two elements array javascript 
Javascript :: string to JSONobject + android 
Javascript :: javascript date set time 23 59 59 
Javascript :: updatedAt 
Javascript :: check if an id exists javascript 
Javascript :: express get jwt token from header 
Javascript :: Codewars Beginner - Reduce but Grow 
Javascript :: array to string js 
Javascript :: Data path "" should NOT have additional properties(es5BrowserSupport 
Javascript :: how to call a javascript function in html without any event 
Javascript :: javascript removing items looping through array 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =