You can use the isNaN function to determine if a value does not convert to a number. Example as below:
function checkInp()
{
var x=document.forms["myForm"]["age"].value;
if (isNaN(x))
{
alert("Must input numbers");
return false;
}
}
More Related Contents:
- Set the value of an input field
- Set the default value of an input field
- HTML form input tag name element array with JavaScript
- JavaScript code to stop form submission
- Why does forms with single input field submit upon pressing enter key in input
- Disable form auto submit on button click
- How to submit a form with JavaScript by clicking a link?
- HTML input file selection event not firing upon selecting the same file
- How to convert Base64 String to javascript file object like as from file input form?
- HTML input type=file, get the image before submitting the form
- How to ensure a form field is submitted when it is disabled?
- How to prevent submitting the HTML form’s input field value if it empty
- How to prevent page from reloading after form submit – JQuery
- Property ‘submit’ of object # is not a function
- Adding rows dynamically with jQuery
- HTML/JavaScript: Simple form validation on submit
- Appending form input value to action url as path
- jQuery Change event on an element – any way to retain previous value?
- Putting default value in
- Dynamically creating a specific number of input form elements
- How to get text of an input text box during onKeyPress?
- Change HTML form ‘input’ type by JavaScript
- How to set custom validation messages for HTML forms?
- Trigger standard HTML validation (form) without using submit button? [duplicate]
- form with no action and where enter does not reload page
- copying the value of a form’s file input field to another form’s input field
- A form’s “action” and “onsubmit”: Which executes first?
- Show/hide password onClick of button using Javascript only
- adding onclick event to dynamically added button?
- Disable spaces in Input, AND allow back arrow?