jquery - outerHeight() method returning a string data type instead of a number data type -
i need jquery method of outerheight() return number data type instead of string data type.
var firsttd = $.trim($(this).find("td:first").outerheight()); alert(typeof firsttd); // output ---> string alert(firsttd); // output ---> 58 and triedusing parseint
var firsttd = $.trim(parseint($(this).find("td:first").outerheight()),10); alert(typeof firsttd); // output ---> string alert(firsttd); // output ---> 58 how can output number data type?
you can removing $.trim() around rest of code. you're receiving integer, there's nothing more trim it. so, use this:
var firsttd = $(this).find("td:first").outerheight(); alert(typeof firsttd); // output ---> number alert(firsttd); // output ---> 58
Comments
Post a Comment