我必須使用一個專有的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