Yes, thx
On May 21, 1:51 am, "Michael Geary" <m...@mg.to> wrote: > Hmm... I just tried a quick and dirty test and it seemed to work the way > you'd want. > > I opened this page: > > http://docs.jquery.com/Main_Page > > And opened the Firebug console and entered these expressions in the console: > > $('#jq-primarySearch').val( '<h1>test</h1>' ); > > That put the expected text in the search form at the top of the page. > > $('#jq-primarySearch').val(); > > The latter one displayed the text as expected. > > Then I clicked the magnifying glass icon to submit the form, and on the > search results page it said: > > You searched for <h1>foo</h1> > > That seems to be what you were looking for it to do, yes? > > -Mike > > > From: eclipseTalk > > > Thanks for your reply. > > This is what I'm trying to achieve: > > - I have a form where a user can select items to order > > - While still in the form, I use JQuery to provide a preview > > of the order. The text is displayed in a popup dialog. It is > > formatted in html. > > - I want to save this html preview into a hidden field that I > > retrieved later on once the form has been submitted. > > > Maybe I need to pass my html text otherwise... Any advise is welcome. > > > Thanks for your time and help > > > On May 20, 11:49 pm, "Michael Geary" <m...@mg.to> wrote: > > > .val(foo) sets the value attribute of the selected DOM element(s). > > > Being an attribute, it can't contain HTML. It would be as > > if you had > > > this code in your page: > > > > <input type="hidden" name="previewText" value="<h2>Order > > Preview</h2>" > > > /> > > > > That wouldn't be valid HTML. > > > > I'm not sure what to suggest instead, because I'm not sure > > what your > > > goal is. Could you back up a level and explain what you want to > > > accomplish with the hidden field? > > > > -Mike > > > > > From: eclipseTalk > > > > > 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