Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个看起来像这样的链接列表
如何让 jQuery 从链接文本中删除字符串“(foo)”?
$('a:contains(foo)').text(function(_, currentText){ return currentText.replace('foo', ''); });
http://jsfiddle.net/EgHkr/
另一种选择
$('li:nth-child(2)').replaceWith('<li>Item 2</li>');