【发布时间】:2012-10-01 00:52:32
【问题描述】:
所以我有一段看起来像这样的 HTML...
<p>This is some copy. In this copy is the word hello</p>
我想使用 jquery 将单词 hello 转换为链接。
<p>This is some copy. In this copy is the word <a href="">hello</a></p>
这本身并不太难。我的问题是,如果这个词已经是一个链接的一部分,比如下面的例子......
<p>In this copy is the <a href="">word hello</a></p>
我不希望它以链接中的链接结束...
<p>In this copy is the <a href="">word <a href="">hello</a></a></p>
任何帮助将不胜感激。
【问题讨论】:
-
你能不能只在文本元素上调用 parent("a") 看看是否不返回 null?
-
你能发布你已经在使用的代码吗?
标签: jquery dynamic-links