Javascript Is Numeric function

function is_numeric(value){
	return !!isNaN(value);
}

Example:

if(!is_numeric('1234five')){
	alert('Please enter only numeric value!');
}
PG

Author: insic

Subscribe in my RSS Feed for more updates on Web Design and Development related articles. Follow me on twitter or drop a message to my inbox.

Random Post

Delicious

5 Responses to “Javascript Is Numeric function”

  1. very helpful madame…

  2. Doesn’t seem to work in Firefox 3.0.10 on Ubuntu Linux. (All strings return True.)

  3. Hello! I like the design of your blog (and content too btw) and I would like to know what theme are you using? Is it your own design or free theme? thanks in advance, regards Pete

  4. Hey, thanks for the blog post, but can you tell me what’s this theme you’re using in your blog? Thanks in advance, Pete

  5. There may be a typo in the function that may explain Brian’s problem.

    Shouldn’t it be:

    function is_numeric(value){
    return !isNaN(value);//single !
    }

Leave a Reply