title: Performance of jQuery script which dynamically shows/removes images
body: <p>I'm thinking about best way to attach an image button to each row of a list. I want every row to have a button. After Click, the script should append a div with image (and run a lightbox).</p>
  
  <p>Do you think optimal way of doing that is:</p>
  
  <ol>
  <li>onClick -> append  and hide them    </li>
  <li>Run LightBox</li>
  <li>onExit -> .remove() images</li>
  </ol>
  
  <p>I'm worried about performance of that. Will it slow browser significantly or rather not?</p>
  
  <p>Fast written code:</p>
  
  <pre><code>function test(){
    $.post(url, {id:'1'}, function(data){
      $("#cache").append(data).children("a").first().trigger("click");
      //returns sth like &lt;a href="" rel="lightbox"&gt;&lt;/a&gt;
    });
  }
  </code></pre>
  
  <p>And in lightbox.js at function which closing down script:</p>
  
  <pre><code>$("#cache").empty();
  </code></pre>