我試圖從使用Javascript和jQuery的html文件中獲取包含文本的節點。 如果我有像 `從html文件中提取文本
<div>txt0
<span>txt1</span>
txt2
</div>
How can I select elements that meets this criteria?? Meaning, I need to retrieve the
DIV and the
span`一個節點,它甚至會更好,知道文本的位置。
我試圖讓文本在隨後的函數中用圖像替換它。 我想這
`
$('*').each(function(indx, elm){
var txt = $(elm).text();
// my code to replace text with images here
});
`
但它不會獲得所需的結果..它所有的分析中第一個元素,並完全改變的HTML。
你想選擇所有在他們的文本中的元素? – Lix 2012-04-02 22:37:01
在你操作之後'
@lix是的, @ JuanMendes:當我找到它們時我會改變它們 – zeacuss 2012-04-03 13:20:05