title: How to make changes made by javascript persistent (rails)
body: <p>I'm trying to make changes made by javascript persistent.
  Specifically, I have a rails app which allows a user to "like" other users' posts. When the user likes (faves) a post, or when a new <code>favorite</code> is created, I want the background colour of the post to change (say, to <code>green</code>) using javascript and/or jQuery (I could not see any other way to do this). The problem is that when I reload the page the change is not persistent, with the background colour turning into the default one.</p>
  
  <p>I've tried the following, none of which worked;</p>
  
  <p><code>addClass</code> in combination with <code>removeClass</code></p>
  
  <p><code>append</code> the <code>&lt;style&gt; ... &lt;/style&gt;</code> tags directly so the changes in styling can be persistent, without success.</p>
  
  <p>I've tried the above both in <code>app/views/favorites/create.js.erb</code> and directly in the view template where faved posts appear using <code>&lt;script&gt; ... &lt;/script&gt;</code> tag.</p>
  
  <p>Any suggestions will be greatly appreciated.</p>