请帮我找到这个问题throw new Error(“语法错误,无法识别的表达式:”msg);
Error: Syntax error, unrecognized expression: #save_property_#{result.id} throw new Error("Syntax error, unrecognized expression: " msg);
home.js:
$(".save_prop").click(function(){
$('#save_property_#{result.id}').slideToggle();
return false;
});
view.html.erb
<div id="save_property_<%= result.id %>" style="background : #ececef; width :500px; height:100px; display:none;">
<% if (user_signed_in? || current_twitter_user || current_fb_user) %>
property saved
<% else %>
<%= link_to "Sign in /", user_session_path %>
<%= link_to "Sign Up", new_user_registration_path %>
to save the property
<% end %>
</div>
选择'#save_property _#{result.id}'的问题,这不是一个有效的jQuery选择。您可能需要执行DOM遍历来查找与被单击的'.save_prop'元素对应的'#save_property_XXX'元素。你需要展示更多的HTML,以便我们看到它们是如何相关的。 – Barmar