Posted By

rduv on 10/31/06


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


image tag alt and title copy


 / Published in: Ruby
 

  1. Firefox doesn't display a popup for the alt attribute for images. While this is according to spec, it's slightly annoying to put the same text in both the alt and the title. Put the following in your ApplicationHelper to copy the alt to the title for every image. Please don't tell me how wrong this is. I don't care.
  2.  
  3. module ApplicationHelper
  4. def image_tag(location, options)
  5. options[:title] = options[:alt] if options[:alt]
  6. super(location, options)
  7. end
  8. end

Report this snippet  

You need to login to post a comment.