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..
精彩评论