I’m using JavaScript to pull a value out from a hidden field and display it in a textbox. The value in the hidden field is encoded.
For example,
You shouldn't have to escape/encode values in order to shuttle them from one input field to another.
JS doesn't go inserting raw HTML or anything; it just tells the DOM to set the value
property (or attribute; not sure). Either way, the DOM handles any encoding issues for you. Unless you're doing something odd like using document.write
or eval
, HTML-encoding will be effectively transparent.
If you're talking about generating a new textbox to hold the result...it's still as easy. Just pass the static part of the HTML to jQuery, and then set the rest of the properties/attributes on the object it returns to you.
$box = $('').val($('#hiddenId').val());