开发者

RoR remote_function pass class name of element

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"
        )
      }) 
%>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜