I don't think you can guarantee that id based css selectors will work on all browsers. And document.getElementById() would also not be guaranteed.
It would be simple to develop a component which converts it's body to a string and updates a parameter binding. This component can then be included in an ajax block so the string is available in page render and ajax update. I'll add an example to tapestry-stitch when I get a chance.