You need to replace (remove) the dots first in the thousands separator, then take care of the decimal:
function isNumber(n) {
'use strict';
n = n.replace(/\./g, '').replace(',', '.');
return !isNaN(parseFloat(n)) && isFinite(n);
}
More Related Contents:
- This doesn’t seem right? Javascript isn’t working
- phone number validation in js [closed]
- What’s the best way to validate an email address in JavaScript?
- Including a hyphen in a regex character bracket?
- How to get the raw value an field?
- What is the minimum valid JSON?
- How to validate date with format “mm/dd/yyyy” in JavaScript?
- How to set HTML5 required attribute in Javascript?
- Javascript: how to validate dates in format MM-DD-YYYY?
- How to test valid UUID/GUID?
- Limit number of lines in textarea and Display line count using jQuery
- Validate phone number using javascript
- Safari JS cannot parse YYYY-MM-DD date format?
- Best JavaScript solution for client-side form validation and interaction? [closed]
- Check if HTML snippet is valid with JavaScript
- HTML/JavaScript: Simple form validation on submit
- Why do we need both client side and server side validation? [closed]
- AngularJS: How do I manually set input to $valid in controller?
- How to show setCustomValidity message/tooltip without submit event
- Check if date is in the past Javascript
- Validate html text input as it’s typed
- How do I add validation to the form in my React component?
- How to set custom validation messages for HTML forms?
- Trigger standard HTML validation (form) without using submit button? [duplicate]
- How do I make an input field accept only letters in javaScript?
- How to programmatically calculate the contrast ratio between two colors?
- JavaScript validation issue with international characters
- How to highlight a part part of an Input text field in HTML using Javascript or JQuery
- Joi Validations: If object matches the schema validate against it from multiple items
- Check if a browser has built-in HTML form validation?