jQuery has height() en width() functions that returns the height or width in pixels as integer...
How can I get a padding or margin value of an element in p
Don't use string.replace("px", ""));
Use parseInt or parseFloat!
This simple function will do it:
$.fn.pixels = function(property) { return parseInt(this.css(property).slice(0,-2)); };
Usage:
var padding = $('#myId').pixels('paddingTop');