I get the padding-left property

 var padding = $(".fixed_block").css("padding-left"); 

But the variable is written the value of + px. How to get only the value so that you can add a number to it?

  • one
    For example: var padding = parseInt($(".fixed_block").css("padding-left")); - Visman Nov.

1 answer 1

Give the value to a number using parseInt :

 var padding = parseInt($(".fixed_block").css("padding-left")); 

You always get the value in pixels, because it always returns in pixels (even if it was originally set to em or something else).