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;
}
}
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
- How to prevent form from being submitted?
- Stop form refreshing page on submit
- HTML5 form required attribute. Set custom validation message?
- Submit form without page reloading
- Submit two forms with one button
- How to get the raw value an field?
- Adding input elements dynamically to form
- Submitting a form on ‘Enter’ with jQuery?
- JavaScript Form Submit – Confirm or Cancel Submission Dialog Box
- How to send a JSON object using html form data
- onchange event on input type=range is not triggering in firefox while dragging
- How do I cancel form submission in submit button onclick event?
- Best Practice: Access form elements by HTML id or name attribute?
- How can I set the form action through JavaScript?
- How to avoid the need for ctrl-click in a multi-select box using Javascript?
- Prevent form redirect OR refresh on submit?
- How to convert Base64 String to javascript file object like as from file input form?
- HTML form action and onsubmit issues
- Understanding HTML Form Element behavior
- How to get number of rows in using JavaScript?
- Form Submit Execute JavaScript Best Practice? [closed]
- How to get the containing form of an input?
- HTML input type=file, get the image before submitting the form
- Drop-down box dependent on the option selected in another drop-down box
- Want HTML form submit to do nothing
- How do I use jQuery’s form.serialize but exclude empty fields
- How to get text of an input text box during onKeyPress?
- Trigger standard HTML5 validation (form) without using submit button?
- Stop an input field in a form from being submitted
- How to prevent page from reloading after form submit – JQuery
- Change value of input and submit form in JavaScript
- Decoding URL parameters with JavaScript
- Property ‘submit’ of object # is not a function
- How to Call a JS function using OnClick event [duplicate]
- How do you limit options selected in a html select box?
- Trigger standard HTML validation (form) without using submit button? [duplicate]
- How to set custom validation messages for HTML forms?
- Change the content of a div based on selection from dropdown menu
- Why does a FORM with one text INPUT submit on enter while one with two text INPUTs does not? [duplicate]
- jQuery Change event on an element – any way to retain previous value?
- a way to check validity of HTML5 forms?
- Getting an option text/value with JavaScript
- submit event does not fire if submit initiated programmatically
- Putting default value in
- Angular form validation ng-disabled not working
- How to create dynamically
- How best to make a link submit a form