cometta
cometta

Reputation: 35689

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 "0 days"

Upvotes: 0

Views: 567

Answers (2)

Mikee
Mikee

Reputation: 2563

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

works fine here..

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038810

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

Upvotes: 3

Related Questions