dwr.util.getValue(id, options) is the read version of setValue(). This gets the values out of the HTML elements without you needing to worry about how a selection list differs from a div.

By default DWR protects against XSS in dwr.util.getValue by escaping potentially dangerous characters. The optional options object parameter allows output escaping to be disabled. Please see the escapeHtml page for more information.

This method works for most 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.getValue( )
Returns " " (Press 'getValue').

HTML Test Elements

A div element with id="div".
Text area (id="textarea"): Selection list (id="select"):
Text input (id="text"): Password input (id="password"):
Form button (id="formbutton"): Fancy button (id="button"):