forms.html 47 KB
Newer Older
Mark Otto's avatar
Mark Otto committed
1001
1002
1003
1004
1005
</div>
{% endhighlight %}

  <h2 id="forms-help-text">Help text</h2>
  <p>Block level help text for form controls.</p>
Chris Rebert's avatar
Chris Rebert committed
1006
  <div class="bs-callout bs-callout-info" id="callout-help-text-accessibility">
1007
1008
1009
    <h4>Associating help text with form controls</h4>
    <p>Help text should be explicitly associated with the form control it relates to using the <code>aria-describedby</code> attribute. This will ensure that assistive technologies – such as screen readers – will announce this help text when the user focuses or enters the control.</p>
  </div>
1010
  <div class="bs-example" data-example-id="simple-help-text">
1011
    <form>
1012
1013
1014
1015
1016
      <div class="form-group">
        <label for="inputHelpBlock">Input with help text</label>
        <input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock">
      </div>
      <span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
Mark Otto's avatar
Mark Otto committed
1017
1018
1019
    </form>
  </div><!-- /.bs-example -->
{% highlight html %}
1020
1021
1022
1023
<label class="sr-only" for="inputHelpBlock">Input with help text</label>
<input type="text" id="inputHelpBlock" class="form-control" aria-describedby="helpBlock">
...
<span id="helpBlock" class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
Mark Otto's avatar
Mark Otto committed
1024
1025
{% endhighlight %}
</div>
For faster browsing, not all history is shown. View entire blame