我必须使用一个专有的CMS博客呈现它的“总结标记”包含删除内容并追加类与jQuery
- 一个省略号
- 一个动态变化的链接(这样的链接永远是不同的)
- 静态文字说:点击这里阅读更多。
这是汇总标记当前如何呈现在页面上:
<p>Content goes here....<a href="example.htm">Click here to read more.</a></p>
<p>More content goes here....<a href="anothertest.htm">Click here to read more.</a></p>
<p>Content goes here....<a href="helloworld.htm">Click here to read more.</a></p>
同时,我想用一些jQuery的,所以我不会被限制在其僵化的显示控制摘要标记:
- 删除每个
ellipsis
- 追加
class
只包含省略号,所以它不href
后更新页面上的其他链接。
这将是期望的预期结果。
<p>Content goes here.<a href="example.htm" class="readmore">Click here to read more.</a></p>
<p>More content goes here.<a href="anothertest.htm" class="readmore">Click here to read more.</a>
<p>Content goes here.<a href="helloworld.htm" class="readmore">Click here to read more.</a>
非常感谢您的帮助!
这是我得到的,这是不好的,我知道
$("p").html("...").remove:after.attr(".readmore").attr("href"));
那么什么或谁“*不更新页面上的其他链接* “? – Alexander 2013-02-15 18:18:39