First, you need to get jQuery in the mix by doing $(html).find(). Then, you should probably be using this syntax: $(html).find('td:contains("UP")').replaceWith(...);
Even better than replaceWith, if you only care about the contents of the <td> tags would be .html('<img ... />'); On May 25, 8:47 pm, DanN <danny_no...@yahoo.co.uk> wrote: > I have a variable called html thats created on document load with > jquery and XML, I want to search that variable for a string, and > replace it with another. > > ie > > html = '<td>UP</td><td>DOWN</td><td>UP</td><td>UP</td><td>DOWN</ > td><td>UP</td>' > > I then basically want to do: > > html.find("<td>UP</td>").replaceWith("<td><img...></td>") > > It does not need to be recursive, but can be. > > If recursive, will get used before the var is dumped to a div. If not > will get used in the loop and change the html var as created and wont > matter. Either way, as long as it works. > > I tried several things, but kept getting this error: > > uncaught exception: Syntax error, unrecognized expression: > > > Please help!