I have a piece of code which dynamically alters the HTML of a div called \'accordion\' on the fly like so:
// htmlstring contains some HTML containing some HTML
Thanks go to Barmar for providing the first correct answer. In actual fact I refactored my code so that I wasn't passing complicated strings via a method parameter, but my you did answer my initial query correctly.
Thanks to other comments for your input too.