Adding class or id tags to tags like linkto and form

I’m trying to figure out things like this by myself so I don’t bother my
developer and slow him down. How do I add class or id css attributes to
tags like this:

<%= form_remote_tag :url => { :action => “send_url” } %>

<%= link_to_remote “My Profile URL”, :url => { :action =>
“send_profile_url”, :id => @user.id } %>

any help would be great.

Element.addClassName(‘element’,‘classnametoadd’);

use that little jscript line right there to add the class name to an
existing element. You could do it in a jscript file, or do it on a
complete of a link_to_remote

<%= link_to_remote “LINK NAME”, {:url => {:controller =>
“thecontroller”, :action => “theaction”}, :update => “somethingupdates”,
:before => %(Element.addClassName
(‘thisElementSucks’,‘theAwesomeClass’)),
:success => %(Element.show(‘thisElementSucks’))}

-Ben L.

Ben,

— form_remote_tag usage —
form_remote_tag(options = {})

— form_remote_tag example —
form_remote_tag(:url => { :action => :fast }, :html => { :id =>
‘your_css_id’, :class => ‘your_css_class’ })

— link_to_remote usage —
link_to_remote(name, options = {}, html_options = {})

— link_to_remote example —
link_to_remote(‘Do this’, { :url => { :action => “destroy” }}, { :id
=> ‘your_css_id’, :class => ‘your_css_class’ })

Zack

Thanks everyone, i’ll give it a try and see if it works for me.

Zack C. wrote:

Ben,

— form_remote_tag usage —
form_remote_tag(options = {})

— form_remote_tag example —
form_remote_tag(:url => { :action => :fast }, :html => { :id =>
‘your_css_id’, :class => ‘your_css_class’ })

— link_to_remote usage —
link_to_remote(name, options = {}, html_options = {})

— link_to_remote example —
link_to_remote(‘Do this’, { :url => { :action => “destroy” }}, { :id
=> ‘your_css_id’, :class => ‘your_css_class’ })

Zack

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs