How to make a newly posted comment the selector in jquery (with rails)?

I am trying to highlight the new message @micropost when it is posted using the second line of this code but am not having any success: $("table.microposts").prepend("<%= escape_javascript(render(:partial => 'shared/feed_item', :object => @micropost)) %>"); $("#table.micropost_<%= @micropost.id %>").effect("highlight", {}, 3000); $("#new_micropost")[0].reset(); This is the feed item partial (I tried using the div_for function to identify the new post...: <%= div_for feed_item do %> <%= link_to gravatar_for(feed_item.user), feed_item.user %> <%= link_to feed_item.user.name, feed_item.user %> <%= feed_item.content %> Posted <%= time_ago_in_words(feed_item.created_at) %> ago. <% if current_user?(feed_item.user)%> <%= link_to "delete", feed_item, :method => :delete, :confirm => "You sure?", :title => feed_item.content %> <% end %> <% end %> <% if @feed_items.any? %> <%= render :partial => 'shared/feed_item', :collection => @feed_items %>
<%= will_paginate @feed_items %> <% end %> Hope that gives sufficient detail. Thanks for any help

以上就是How to make a newly posted comment the selector in jquery (with rails)?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏