I am dynamically creating a table within a web page. I know how to do that. However, some of data names contain an apostrophe, e.g. "O'Brien". I use insertRow/insertCell to create new rows and columns but when I attempt to set innerHTML on a cell for one of these data names it fails.
If I replace the apostrophe, it works fine, e.g.
I also tried to just create a text node and append it to the cell, e.g.
That does not seem to work either. Why do these operations fail for data names with apostrophes? Is there a workaround? [ September 05, 2008: Message edited by: Jay Damon ]
Yeah, it should work. Apostrophe is no different from any other character when it comes to data. The problems that can be introduced are syntactic, and only arise when creating string literals and attribute values.
At this point you'll probably need to pare down a code example to the simplest sample that demonstrates the issue and post that code. [ September 05, 2008: Message edited by: Bear Bibeault ]
With replace(), you are running into regular expression syntax problems as well. I didn't think that replace() was part of the original problem.
If you don't want to post code, not much more that can be said.
Joined: Jul 31, 2001