title: Template rendered callback
body: <p>I'm using jquery tabs in my code. I need to call $('ul.tabs').tabs(); after once the HTML is rendered. But this is throwing error "Type : d[0] is undefined". The code which is used is below.</p>
  
  <pre><code>&lt;template name="customersMapping"&gt;
      &lt;div class="col s9 blue-grey lighten-5" id="side-right"&gt;
                 &lt;div class="row"&gt;
                      &lt;div class="col s12"&gt; 
                        &lt;ul class="tabs" id="usersMappingTab"&gt;
                         {{#each customerClientMapping}}
                            &lt;li class="tab col s2"&gt;&lt;a href="#{{_id}}_Tab"&gt;{{name}}&lt;/a&gt;&lt;/li&gt;
                         {{/each}}
                        &lt;/ul&gt;
                      &lt;/div&gt;
                      {{#each customerClientMapping}}
                          &lt;div id="{{_id}}_Tab" class="col s12"&gt;
                              {{#each userChats ..}}
                                  &lt;div&gt;{{name}}: {{message}}&lt;/div&gt;
                              {{/each}}
                          &lt;/div&gt;
                      {{/each}}
                &lt;/div&gt;
             &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>In client.js</p>
  
  <pre><code>Template.customersMapping.rendered = function() {
      if ($('#usersMappingTab').length &gt; 0) {
                  $('ul.tabs').tabs();
      }
  };
  
  Template.customersMapping.helpers({
      'customerClientMapping' : function() {
          return UserChatsMapping.find({cid : Meteor.userId()}, {sort: {time: -1}});
      },
      'userChats' : function() {
          return Messages.find({uid:this.uid}, {sort:{time: -1}});
      }
  });
  </code></pre>
  
  <p>I think the jquery function is called before the HTML is rendered. Please let me know how to fix this.</p>