Creates a label field
Options
- Creates standard HTML attributes for the tag.
Examples
label_tag 'name' # => <label for="name">Name</label> label_tag 'name', 'Your name' # => <label for="name">Your Name</label> label_tag 'name', nil, :class => 'small_label' # => <label for="name">Name</label>
Source Code
# File action_view/helpers/form_tag_helper.rb, line 131 def label_tag(name, text = nil, options = {}) content_tag :label, text || name.humanize, { "for" => name }.update(options.stringify_keys) end
<code/>and<pre/>for code samples.