Javascript Error - Single Quote breaks the parameter

I am using dataTable to populate a list of data. It uses rowOnClick option to pass set of paramteters.

Some of the values have ' (single quote) in them. When I click on it, complains the parameter is not complete. For example:

onClick ="CallData('firstname', 'address's' )"

See the address has a ' in it. How can I replace this values. I tried to use replaceAll method and tried to replace with ´ and \'. JSF does not accept them.

What is the common solution for this?. I cannot replace them inside the code also. Since It is a List.

Any tips would be highly appreciated.

Yogi

[660 byte] By [SoftwareYogia] at [2007-11-26 17:34:46]
# 1
How are you replacing the singlequote?string = string.replaceAll("'", "\\\\'");should do.
BalusCa at 2007-7-9 0:02:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
I tried that too. But the \ is showing in the datalist in HTML output.
SoftwareYogia at 2007-7-9 0:02:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Fixed. I used a seperate variable for showing the name :). Thanks
SoftwareYogia at 2007-7-9 0:02:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...