JQuery Plugin Repository

Close Complete List of Plugins

toggleMoreInfo  |  Category: Forms  |  Modified: 31 Aug 2009  |  Display form field for more information when a checkbox is checked.

This plugin is applied to one or more checkbox elements to dynamically create an associated textarea for more information. The contents of the textarea are saved as part of the value of the checkbox, thereby eliminating the need for an additional database entry. If the checkbox is checked on page load, the textarea is also created and populated with the checkbox's value.

Summary

Script File

jq.toggleMoreInfo.js ( view )

Available Options

cols

An integer specifying the cols (width) value for the created textarea. Default value is 50.

rows

An integer specifying the rows (height) value for the created textarea. Default value is 5.

chars

An integer specifying the maximum number of characters allowed for the created textarea. Enter "unlimited" for no character counter. Default value is 255.

instr

A string specifying the additional instructions to be displayed. If explanatory text already exists, set to "inline". Default value is "Please explain below.".

Basic Usage

$("ELEMENT").toggleMoreInfo();

$("ELEMENT").toggleMoreInfo({ options });

Minimum Browser Support

  • Apple Safari 3
  • Google Chrome 1
  • Microsoft Internet Explorer 6
  • Mozilla Firefox 3
  • Opera 9

Example

  1. Indicator A.
  2. Indicator B.
  3. Indicator C.
  4. Indicator D.

Associated Code

<script type="text/javascript">
$(document).ready(function() {
  $("input.moreInfoA").toggleMoreInfo({
    cols  :  40,
    rows  :  3,
    chars :  50,
    instr : "Generated instructions for text area below."
    });
  $("input.moreInfoC").toggleMoreInfo({
    cols  :  40,
    rows  :  3,
    chars : "unlimited",
    instr : "inline"
    });
  $("input.moreInfoD").toggleMoreInfo({
    cols  :  40,
    rows  :  3,
    chars :  500
    });
  });
</script>

JQuery Plugin Repository | Home | Print

back to ksscholl.com