Flowdock
label_tag(name = nil, content_or_options = nil, options = nil, &block) public

Creates a label element. Accepts a block.

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" class="small_label">Name</label>
Show source
Register or log in to add new notes.
September 18, 2008
1 thank

unobstrusive label tag

just use

label_tag('a_a','a_a') 

and it works, just not ment for pure decorative labels :)

September 17, 2008
0 thanks

removes underscores -> do not use for images etc

example

#does not work
label_tag('aa'+image_tag('x_x.gif')) 
January 9, 2009 - (v2.2.1)
0 thanks

Dynamic labels

Code example

<%=label_tag 'category_'+cat.title, cat.title%>