I have a link on my page that lets me delete items from my database -
I currently use CSS to insert a background image of a cross (an X).
I want to display ‘alt’ text explaining that the button deletes items
from the db but I know this can’t be done with CSS.
What is the rails code for doing this?
Currently I have
<%= link_to ‘del’, :action=>:destroy %>
The reason I need the alt text is becuase I have set the word ‘del’ to
be 0px so that it doesn’t appear on scree. I just want to have the
button.
Is there a way to make the image show ‘alt’ txt when someone rolls
over it?
<%= link_to ‘del’, :action=>:destroy %>
just use it the normal way instead:
<%= link_to(image_tag("/images/icons/delete.png", :alt =>
“delete”, :title => “delete”), :action => :destroy) %>
Also as an FYI: The “alt” attribute is used to provide alternate text
for non-graphical clients and for screen readers. The correct
attribute for tool tips is “title.” Yes I realize that IE will display
alt text as a tool tip, but IE is stupid and broken. Don’t beleive me?
Then read the w3c specs on the two attributes and see for yourself.
Thank you very much both of you!
I will start using Title from now.
Regds
steve