我正在构建一个div并将其附加到主div.在这样做的时候,我需要在构建它之前和附加它之前获得div的高度.
例如,
<script> $(function(){ var text = $("#ObjText").html(); // This text is dynamic var dv = $("<div id='childDiv'>"+text+"</div>"); alert($(dv).height()); // This is getting '0' - Need to get the height of the div here. $("#page").append(dv); //After appending to page able to get the height of the child div alert($("#childDiv").height()); }); </script>
在我的身体标签,
<body> <div id="page"></div> </body>
请帮我解决这个问题.提前致谢.