title: Running a function AFTER a meteor template is updated
body: <p>I have a meteor template rendering some html that I need to perform a jquery function on. Right now, I've set up a dependency so that every time the data (a list of objects) tied to that template changes, the function runs. I'm not at all sure this is the best way to do what I'm trying to do, but it does run the function every time I add/delete/rearrange objects, so that's a start. </p>
  
  <p><strong>However</strong>, the function seems to be running before the template is re-rendered, so the previous set of blocks get jquery-fied, but any blocks I've just added on that action do not.</p>
  
  <p>Is there a way to force a function to run AFTER a template is rendered/updated? Any help is much appreciated!</p>
  
  <p>(similar question here -- <a href="https://stackoverflow.com/questions/27882387/meteor-reactive-jquery">Meteor reactive jquery</a> -- but it doesn't have any answers)</p>
  
  <p>Here are some maybe-relevant code bits:</p>
  
  <pre><code>Template.showPictures.rendered =
      Deps.autorun () -&gt;
        album = Albums.findOne(Session.get("selectedAlbum"))
  
        if (album)
          pictures = album.orderedPictures()
          MyApp.loadJQuery()
  
  Template.showPictures.helpers
    pics: -&gt;
      MyApp.myDependency.depend()
  
      album = Albums.findOne(Session.get("selectedAlbum"))
      album.orderedPictures()
  </code></pre>
  
  <p>(Why is the autorun in my Template.rendered thing? Not sure. That seemed like an okay place to put it, but this is my first time really dealing with dependencies, so I could be totally off-base here. Any ideas whatsoever on what's going wrong would be excellent.)</p>