我将 td
的高度设置为 auto
并希望将 td
的 height
设置为colorbox
中的其他 td
。这是我的 html
<tr>
<td class="heading1" id="mhheading"><?php echo $this->translate("Medical History"); ?> </td>
<td class="info1" style="height:auto;" id="mhinfo"><?php echo $this->patientDetail['medical_history'];?></td></tr>
我正在获取 id="mhinfo"
的高度,并希望在 id="mhheading"
中进行设置。
我的jquery代码如下
$(document).ready(function () {
$('#mhheading').css('height',$('#mhinfo').height());
console.log($('#mhinfo').height());
});
我在控制台中看到它返回0
。我使用了 window.load
和 document.load
,但在所有情况下它都返回 0
。我再次在 colorbox
中使用所有这些代码。
最佳答案
你有表格标签吗?我认为你需要添加表格标签
<table>
<tr>
<td class="heading1" id="mhheading"><?php echo $this->translate("Medical History"); ?> </td>
<td class="info1" style="height:auto;" id="mhinfo"><?php echo $this->patientDetail['medical_history'];?></td>
</tr>
</table>
关于javascript - $.height 在 colorbox 中返回 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18746340/