Information Technology Dark Side

Struggles of a Self-Taught Coder

Information Technology Dark Side header image 2

How to replace formtastic inline hints with tooltips

July 26th, 2012 · No Comments

This little bit of coffeescript can be used to replace inline hints from formtastic with a tooltip that appears whenever the user hovers over an image.

$('.formtastic p.inline-hints').each (index) -> 
    $(this).hide()
    label = $(this).siblings('label')
    label.append(
        "<a href='#' title='" + 
           $(this).html() + 
           "' class='hint_modal'>
           <img src='/assets/qm_small.png' 
           style='vertical-align: middle;'/>
           </a>"
      )
    label.find('a.hint_modal').tooltip()
If you enjoyed this post, make sure you subscribe to my RSS feed!
Stumble it!

Tags: Uncategorized

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment