-4
我在使用jquery訪問子項時遇到了一些問題。 我有一個HTML這樣jquery在div中找到一個元素
<div id="wrapper">
<div>
<div>
<table id="customer">
</table>
</div>
</div>
</div>
我有這個jQuery這樣
var parentDiv = $('#wrapper');
var table= parentDiv.html();
console.log(table);
輸出
<div>
<div>
<table id="customer">
</table>
</div>
</div>
table = $(table); //jquery object
//i want the table customer of this object
我要的是讓客戶表。我怎樣才能使用var表? .each()僅提取div以及.find()。
像這樣
$(innerHtml).each(); //or whatever function i can use to get the table
使用'$( '#客戶')'沒有必要找 – guradio
耶,我可以這樣做,但我想要的是讓innerHtml的表。 – n4mi
哪個div內部的html? –