Sandbox: JavaScript

Allows users to enter an "other" value for a select list.

Note You need to update your controller to interpret the selection of the "other" option as an instruction to use the value in the text input.

Examples

<p>
  <select data-trigger="selectWithOther" data-selectwithother-options="
    'hideClass': 'hide',
    'target': '!div input'
  ">
    <option>first</option>
    <option>second</option>
    <option>other</option>
  </select>
</p>
<div class="form-group">
  <input type="text" name="html" value="" placeholder="..." class="form-control input-hg" style="display:none">
</div>

Behavior Options

These options apply only to the data- tag invocation.

Name type default description
otherValue string 'other' The value of the "other" option.
target string ~ Selector to find the element to show when the "other" option is selected.