how to get wrapper height if wrapper height: auto;? And when you get wrapper height then set on other element wrapper height.
var h = document.getElementById('wrapperDiv').clientHeight;
var h = document.getElementById('wrapperDiv').offsetHeight;
clientHeight includes any vertical padding.
offsetHeight includes any vertical padding, scrollBar, and the border.
how to set on element height?
Not sure what you’re doing or what the code is that you are weaving this into, but you could set it with:
document.getElementById('otherDiv').style.height = h; //The variable used in the previous example defining 'h' as the wrapper height.
Don’t you want the #block height to equal the height of the #wrapper when #block is clicked? You have it setting #block height equal to #block height which is redundant.
Am, yes I want to do block equal to wrapper. Can you show how to do it?
Sorry. You can’t change clientHeight [facepalm]. Use the style object of your div. Here’s a new pen: http://codepen.io/anon/pen/sKruF
.. delete this post
You must be logged in to reply to this topic.