title: How to get Top Offset of newly injected markup
body: <p>I've to scroll to the elements location, <code>scrollTop</code> It works fine for the elements which are present on the page.</p>
  
  <p>But the same thing when I tried with the injected code its not working. It throws an error saying "<strong>Cannot read property 'top' of null</strong>"</p>
  
  <p>Do I need to delegate to get offset? I know to bind any event I've to. If so then how to do. I'm not getting any solution on the net.</p>
  
  <p><strong>Edit 1 ::  Adding Code</strong></p>
  
  <pre><code>var element = $('#teacher-recipe-form').find('.clsError').not('label, hidden').first();
  if( element.is('input:hidden') ) {
      element = element.parent();
  }
  var top = element.offset().top - 5;
  $('html, body').animate({
      scrollTop: top
  }, 500, function(){
      if( element.is('input') || element.is('textarea') ) { element.focus(); }
  });
  </code></pre>
  
  <p>It works fine for already existing elemnt, but not working for the Injected element.</p>