dwr.util.setValue(id, value [, options])
finds the element with the id specified in the first parameter and alters its contents to be the value in the second parameter.
This method works for almost all HTML elements including selects (where the option with a matching value and not text is selected), input elements (including textareas) divs and spans.
For example:
dwr.util.setValue
(
,
)
HTML Test Elements
Text area (id="textarea"): | Selection list (id="select"): | ||
Text input (id="text"): | Password input (id="password"): | ||
Form button (id="formbutton"): | Fancy button (id="button"): |
setValue() allows use of an options object which allows the escapeHtml:false option to prevent DWR from performing output escaping. For example:
<span id="x"></span> dwr.util.setValue('x', "<b>Hi</b>");
Will create a span that looks like this: <b>Hi</b>. But on the other hand, this:
<span id="x"></span> dwr.util.setValue('x', "<b>Hi</b>", { escapeHtml:false });
Will create a span that looks like this:Hi
See also setValues()
and the corresponding getValue[s]()
methods.