Possible Duplicate:
Check if a variable contains a numerical value in Javascript?
How do I check if variable is an integer in jQuery?
Example:
if (id == int) { // Do this }
Im using the following to get the ID from the URL.
var id = $.getURLParam("id");
But I want to check if the variable is an integer.
Try this:
$.isNumeric(id)checks whether it’s numeric or notMath.floor(id) == idwill 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.