Forum: Ruby on Rails Adding the attribute ID to HTML Element <a>

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
J. m. (Guest)
on 2007-02-20 02:08
Hi,

How can I add the attribute id to <a> element when using link_to_remote?

Here what I'm doing:
link_to_remote("Shoe",
      :update=>"tag_cloud_header",
      :url =>{:controller =>:header, :action=>:hide_tag_cloud});

This produces an HTML like

<a href="#" onclick="new Ajax.Updater('tag_cloud_header',
'/header/hide_tag_cloud', {asynchronous:true, evalScripts:true}); return
false;">hide</a>

But I need to put the id in the rendered code like

<a href="#" id="someId" onclick="new Ajax.Updater('tag_cloud_header',
...

Thanks
Wes G. (Guest)
on 2007-02-20 03:16
J. mp wrote:

link_to_remote("Shoe",
       :update=>"tag_cloud_header",
       :url =>{:controller =>:header, :action=>:hide_tag_cloud},
       :id => "someId"
);
 should work.
This topic is locked and can not be replied to.