替换无序列表(html)+ JQuery中的值
问题描述:
我只需使用JQuery更改<span>
和</span>
D1,D2,D3之间的值,并使用JQuery更改X1,X2,X3等新值.
I need to change just the values between <span>
and </span>
D1, D2, D3 with JQuery, with new values like X1,X2,X3 with JQuery.
答
使用
$('#navigation').find('span').each(function(){
var $this = $(this);
$this.text(function(i, curr){
return curr.replace(/D/, 'X');
});
});
这完全符合您的示例.