title: how to trigger an event on onload of <textarea>
body: <p>In my application there are few <code>&lt;textarea&gt;</code> presents and applied pagination to all these <code>&lt;textarea&gt;</code>. On a page one <code>&lt;textarea&gt;</code> is displayed. </p>
  
  <p>Assume there are 10 <code>&lt;textarea&gt;</code> exist, then there will be exist 10 pages, one <code>&lt;textarea&gt;</code> on each page.</p>
  
  <p>I have applied auto fit feature to these <code>&lt;textarea&gt;</code>, written below function for this :</p>
  
  <pre><code>function resizeTextarea(id) {
  
      var minHeight = "75px"; 
      textareaObj = document.getElementById(id);
  
      var scrollH = textareaObj.scrollHeight+'px';
      if((textareaObj.style.height != scrollH) &amp;&amp; (textareaObj.scrollHeight!=0)){
         textareaObj.style.height = scrollH;
      } else
      {
         textareaObj.style.height = minHeight;
      }
  }
  </code></pre>
  
  <p>I have called this function on some events in <code>&lt;textarea&gt;</code> element defination i.e. :</p>
  
  <pre><code>&lt;textarea class="autoGrow" onkeyup="resizeTextarea(this.id);" onchange="resizeTextarea(this.id);" onkeydown="resizeTextarea(this.id);" onmouseup="resizeTextarea(this.id);" onfocus="resizeTextarea(this.id);" style="width:78%;height:75px;overflow:hidden" onclick="resizeTextarea(this.id);" rows="6" cols ="80" id="input"&gt;&lt;?php echo decodeChars($textdata) ;?&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>Auto fit feature works properly once user triggers above mentioned events, i.e. onchange,onkeyup,onkeydown.</p>
  
  <p>I stuck to one main problem that, <strong>auto fit feature wont work once page get's load.</strong></p>
  
  <p>for this I have also added below code on document.ready i.e. </p>
  
  <pre><code>$(document).ready(function() {
         if($('.autoGrow')) {
           var setOfElement = $('.autoGrow');
           for(var i = 1 ; i &lt;= setOfElement.length ; i++) {
              resizeTextarea(setOfElement[i].id);
            }
      } 
  });
  </code></pre>
  
  <p>Still facing same problem that, user explicitly needs to click or jumps to <code>&lt;textarea&gt;</code> to work my auto fit feature.</p>
  
  <p>Please folks suggest me any pointers you have.</p>
  
  <p>Your sugggestion will helps me lot.</p>
  
  <p>Thanks</p>
  
  <p>-Pravin             </p>