Hey there, I'm new to this so bear with me. I have a jQuery question that's puzzling me...
I'm attempting to set the line height using the following method:
var line_height = $('.container').css("height");
console.log(line_height);
$('.vertical-line').height(line_height - 1000);
However, for some reason, I'm unable to calculate line_height - 1000
even though line_height
should be a number (I confirmed with console.log
). Instead of getting the desired result, line_height - 1000
returns NaN.
Any assistance would be greatly appreciated. Thank you!
I've tried a few different approaches but none seem to do the trick...
Option 1:
var line_height = $('.container').css("height");
$('.vertical-line').height(line_height);
Option 2:
var line_height = $('.container').css("height");
var h = line_height - 1000;
$('.vertical-line').height(h);
Option 3:
var line_height = $('.container').css("height") - 1000;
$('.vertical-line').height(line_height);