How do I retreive the line-height of an element without the “px”?
Using this I get the full line-height value including the px.
$('#example').css('line-height');
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Parse it as an integer with
parseIntparseInt($('#example').css('line-height'), 10);Outputs:
18As an integer. The other solutions maintain the String type.
EDIT
For values that may contain decimal points, you can use
parseFloat()parseFloat($('#example').css('line-height'));Outputs:
18.4