Determine if JavaScript value is an “integer”? [duplicate]

Try this:

if(Math.floor(id) == id && $.isNumeric(id)) 
  alert('yes its an int!');

$.isNumeric(id) checks whether it’s numeric or not
Math.floor(id) == id will then determine if it’s really in integer value and not a float. If it’s a float parsing it to int will give a different result than the original value. If it’s int both will be the same.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)