image tag alt and title copy


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments


You need to login to view comments.