views:

342

answers:

2

Hello Gurus,

Im looking for function that will allow me to replace all dollar symbols within a div to "CHF" (another currency). The reason is that the currency symbol is hardcoded and it should be replaced.

Is there a simple way of doing this?

Many thanks in advance.

+5  A: 
jQuery('div').each(function(i){ jQuery(this).text(jQuery(this).text().replace('$','CHF')) })
Chris S
Note, slight modification. I changed it to use .text() instead of .html(), since technically you only want to update the div text contents, not the attributes, script tags, etc.
Chris S
A: 

This appears to change only the first instance of the dollar symbol. How would the script be changed to change all dollar symbols on the page?