[jQuery] Setting hidden field value in html

[jQuery] Setting hidden field value in html


Hello,
I have an hidden field in a form defined as follow:
<input type="hidden" name="previewText" value="" />
To assign its value I used:
var contentText = "<h2>Order Preview</h2>";
$("input[name='previewText']").val(contentText);
It works fine but the html code is lost. Is there a way to retain the
html format?
Thank you