I want to know is there any way in JavaScript to determine height of the content so that I can reset the height of container.
for example I have a div which have height 200px. div have content which cover less height (assuming 40px). How can I get the height if I add more content in it.
You can set the height to an empty string, add your new content, and measure the offsetHeight of the element. Of course if you don’t want to see it flash briefly, you can do it in a copy of the element with visibility set to hidden. If you are near the right or bottom edges of the browser window, it may try to force the element to fit on screen, if you don’t want this, absolutely position the element and give it negative top and left coordinates.