开发者

how to jquery replace space also

$(this).html().replace("0 days","");

i want to replace "0 days" to become "". Currently the above statement will replace "0" to "" . that is not what i want. i want to replace entire statement开发者_C百科 "0 days"


This will replace only the first occurrence. If you want to replace all occurrences:

$(this).html().replace(/0 days/g, '');

Example:

alert('foo 0 days bar 0 days foobar'.replace(/0 days/g, ''));

shows:

foo bar foobar


http://www.jsfiddle.net/jrJga/

works fine here..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜