我有以下HTML stucture:選擇兒童
<td title="Test Info - Displays another Web page on this Web page. The other Web page is presented in an IFrame." class="ms-WPHeaderTd" id="WebPartTitleWPQ2">
<h3 class="ms-standardheader ms-WPTitle" style="width: 778px; text-align: justify; overflow: hidden; text-overflow: ellipsis;" name="MSOFixedWidthTitle" fixedWidth="800px">
<nobr>
<span>
Text - I want this text
<span id="WebPartCaptionWPQ2"/>
所以我試圖讓下td
用的ID跨度的文本值:通過執行下一個WebPartTitleWPQ2
:
var spans = $("#WebPartTitleWPQ2").children("span")
SO然後spans.length
總是0.
我在做什麼錯了?這兩個
編輯
做的兩個值返回
$("#WebPartTitleWPQ2").find("span").text()
結果blank
你試過'$( 「#WebPartTitleWPQ2」)。找到( 「跨度」)' – Dutchie432 2012-04-19 20:55:11
你能告訴我們的HTML完整TD節點? (包括任何結束標記。) – devstruck 2012-04-19 21:27:31