我试图从使用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