In remote_function
how can i pass the className of the form element
i have the following code,
<%=link_to(content_tag('span',t('country.name')),'#',
{:title=>t('country.name'),**:class=>"change_list"**,
:onclick=>remote_function(:url => {:action => :change_view},
:with =>"'**change**=**'+ ?????"**)}) %>
so, on onclick, i want to pass the parameter :change
with the value o开发者_JAVA技巧f :class=>"change_list"
thanks,
If I am understanding correctly, that you want to pass the class name of the anchor tag in your Ajax request, then the following should work (re-formatted to try and improve readability):
<%= link_to(
content_tag('span', t('country.name')),
'#',
{ :title => t('country.name'),
:class => "change_list",
:onclick => remote_function(
:url => {:action => :change_view},
:with => "'change=' + this.className"
)
})
%>
精彩评论