title: Using Coffeescript to hide a <div> in rails
body: <p>I have a list of items that I render via a call to a partial</p>
  
  <pre><code>render @items
  </code></pre>
  
  <p>each item is placed inside a div and has a JS 'disable' link</p>
  
  <pre><code>&lt;div id="item_id_&lt;%=item.id%&gt;
     &lt;%=item.name&gt;
     &lt;%= link_to disable_item_path(item), :remote =&gt; true %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Inside the controller, I change the flag of the item in the database to False, and want to re-render the page and remove the item from the list.</p>
  
  <p>I have been doing so by the following code in disable.js.coffee</p>
  
  <blockquote>
    <p>$('#items_list').html("&lt;%= escape_javascript(render(:partial =>
    @items)) %>")</p>
  </blockquote>
  
  <p>My question: I would like simply to hide the specific item DIV, and not re-render all the items on the page (why? because I think it's better coding). </p>
  
  <p><strong>How do I do that?</strong> I tried passing @item_id to the coffeescript, and doing something like</p>
  
  <pre><code>$('item_id'+@item_id).hide
  </code></pre>
  
  <p>but from reading around here it seems like it's the wrong way of doing so.</p>
  
  <p>Thanks!</p>