I have two div's. #divA & #divB.
#divA has a width of 100% and I want to get the px value of the div and apply it to #divB as it's height CSS. I've tried using .offsetWidth but to no avail. Can anybody help me?
I have two div's. #divA & #divB.
#divA has a width of 100% and I want to get the px value of the div and apply it to #divB as it's height CSS. I've tried using .offsetWidth but to no avail. Can anybody help me?
use .css('width') to keep units intact (ex: 400px), use .width() to get just the numerical value (ex: 400) for use in mathematical computations.
for what you're doing:
if you're getting mathematical:
If you don't want to use jQuery:
With jQuery
EDIT