Simple Tooltip with Ruby on Rails

1st Step

add this code in app/helpers/application_helper.rb

def tooltip(content, options = {}, html_options = {}, *parameters_for_method_reference)
html_options[:title] = options[:tooltip]
html_options[:class] = html_options[:class] || ‘tooltip’
content_tag(“span”, content, html_options)

2nd Step

add code in app/views/foo/page.rhtml

3rd Step

add stylesheet in public/stylesheets/yourstyle.css

.mytooltip {
cursor: help;
color: green;
border-bottom: 1px dotted green


One thought on “Simple Tooltip with Ruby on Rails

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s