vote_up.js.erb:
1 $(".total-vote-count").val("#{@plusminus}")
2 $("a.vote-up-off").addClass("vote-up-on")
My view:
11 #voting
12 #vote-count
13 = link_to "Vote Up", {:controller => 'reviews', :action => 'vote_up', :id => @review.id},
14 {:class => "#{@vote_up_status}", :remote => tru开发者_如何学Pythone }
15
16 %span.total-vote-count
17 = @review.plusminus
18
19 = link_to "Vote Down", {:controller => 'reviews', :action => 'vote_down', :id => @review.id},
20 {:class => "#{@vote_down_status}", :remote => true}
I know that the js.erb does render because when I do something on the entire vote-count div to replace it with text("what is up") it works. But what I have doesn't :(
Help?
Errr, I'm a noob, but in your js.erb, aren't you supposed to use <%= =>
? Like $(".total-vote-count").val("<%= #{@plusminus} %>")
?
精彩评论