jQuery Get CSS Value As an Integer

February 17, 2016 — Leave a comment

Problem
In jQuery, getting a numeric property returns a string.
What if we want a css property value as an integer or float?

Solution

parseInt($('#elem').css('top'));
parseFloat($('#elem').css('top'));

Mike

Posts Twitter Facebook

My name is Michael Le, and I am a web developer.

No Comments

Be the first to start the conversation.

Leave a Reply