(Apologies if a previous message was posted inadvertently. My finger
slipped on the enter key.)
While converting a static HTML prototype to Rails I changed a bunch of
alinks from this:
to the more Railsesque construction shown here:
<%= link_to(image_tag(‘findTab.jpg’, :alt => ‘Find an item’), :action
=> ‘Find’) %>
Sharp-eyed readers will note that the class=“rollover” attribute,
which was provided by Javascript, is now gone. While image_tag has
an :alt option in the hash there is no :class option.
How can I restore the class=“rollover” attribute if image_tag doesn’t
support it, or at least get the rollover behavior back somehow?
However, that adds the class to the anchor tag, not the image…
Sharp-eyed readers will note that the class=“rollover” attribute,
which was provided by Javascript, is now gone. While image_tag has
an :alt option in the hash there is no :class option.
Actually, any option you pass to image_tag will be in the generated html
tag
as an attribute: