function openFaceBox(path) {
$.ajax({
type: "GET",
url: path,
success: function( data ) {
$.facebox( data ); // data returns html
var tableHeight = $(data).find('table').height();
console.log( tableHeight ); // Output : 0 (Zero)
}
});
}
我的 AJAX 返回 html 如下:
<div id="holder-1">
<h1>Content 1</h1>
</div>
<div id="holder-2">
<h1>Content 2</h1>
</div>
<div id="holder-3">
<h1>Content 3</h1>
</div>
<table>
<tr>
<td>abcd</td>
<td>Some Text Here Some Text Here Some Text Here Some Text Here
Some Text Here Some Text Here Some Text Here Some Text Here Some Text
Here Some Text Here Some Text Here Some Text Here Some Text Here Some
Text Here Some Text Here Some Text Here Some Text Here Some Text Here
Some Text Here Some Text Here Some Text Here Some Text Here Some Text
Here</td>
</tr>
</table>
我不知道为什么.find()
不工作。基本上我想找到桌子的高度。任何困惑请告诉我。