Click here to Skip to main content
15,923,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi i want to check to see if value entered by the user is a valid integer using jquery

What I have tried:

i have tried this, but it always seems to return true

JavaScript
if ((manageridEntered === "") || ($.isNumeric(manageridEntered))) {

                           success = false;
                       }
Posted
Updated 15-Nov-16 3:53am

This should help
JavaScript
 if(Math.floor(manageridEntered) == manageridEntered && $.isNumeric(manageridEntered ))
success = true;
 alert( success);
 
Share this answer
 
Comments
Member 12851604 15-Nov-16 8:37am    
This will always return true.
Ramesh_4959 30-Dec-19 7:52am    
it will fail when value is 1.0.
try this

JavaScript
if ((manageridEntered !=  "") && $.isNumeric(manageridEntered)) {

            success = false;
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900