1
我想捕捉一個特定的註釋行。下面的代碼工作確定爲每一個瀏覽器當然除了IE:如何在IE中使用JS/jQuery捕獲註釋nodeType 8?
<script>
var llf = jQuery('.select').contents().filter(function() {
return this.nodeType === 8 // Comment node
})[2].nodeValue.replace("LLF: ", "").trim();
console.log(llf);
alert(llf);
</script>
這是HTML:
<td class="select" nowrap="nowrap" rowspan="3">
<!-- NON IDEAL REASON: 1 hour time window -->
<b>$423.59</b><br />
<b>£267.50</b><br />
<!-- Policy Name: Investment Bank -->
<!--LLF: 1253.12 --> //This is the line I want to capture
如果有辦法做到這一點偉大的所有瀏覽器,但如果你能想到IE +條件註釋的特定解決方案也很好。
謝謝!
那個小細節。謝謝先生,指出這一點。 :) – fedxc
@fedxc:大聲笑,沒有煩惱,很高興它有幫助。 –