jQuery + CSS. How do I compute height and width of innerHTML?
问题 I have a typical parent-child div hierarchy for a Web project using jQuery. The child css has not height, this allows it to expand and contract based on the height of the innerHTML. I am programmatically stuffing HTML markup into the innerHTML property of the child. I want to set the height of the parent to match the height of the child after the child has it's markup. How do I do this? I tried: childDiv.innerHTML = content; childDivObject = $(childDiv); parentDivObject = $(parentDiv);