2
我正在遍历记录并想创建记录的切换选项,但我无法用记录替换div-id:在jQuery语句中对Ruby变量的评估传递给:onclick in Rails
<% for bill in @bills %>
<% tmp = "test"%>
<%= link_to '» now','#', :onclick => '$("#{tmp}").toggle();' %>
非但没有的:
<a href="#" onclick="$("#test");">» now</a>
我越来越:
<a href="#" onclick="$("#{tmp}").toggle();">» now</a>
所以没有评价字符串中的ruby变量。我怎样才能做到这一点?
感谢您的帮助,我是jQuery新手。需要
嗨mikej, 解决方案终于::onclick =>“$(\”\ ## {tmp} \“)。toggle();” 我需要包含ID为#的ID。 – 2010-05-20 13:34:40