title: Display Wordcount on Page Load
body: <p>This might sound like a noob question but I have a problem with a simple function that <strong>should display a wordcounter on page load</strong>. At the moment I created one that displays the result on focus but I cannot get it running right off.</p>
  
  <p>There is a textarea that gets its content from database, so that when the page is loaded, the textarea is already filled.</p>
  
  <p>This is the code right now:</p>
  
  <pre><code>var oTextArea = $('#textarea');
  var oDisplay = $('#display');
  
    oTextArea.on('focus', function()
      {
        var words = this.value.match(/\S+/g).length;
        if (words &gt; 1)
        {
            oDisplay.text(words);
        }
      });
  </code></pre>
  
  <p><a href="https://jsfiddle.net/fischkopp/2vrLLtfr/" rel="nofollow noreferrer">https://jsfiddle.net/fischkopp/2vrLLtfr/</a></p>
  
  <p>I tried numerous things beside that "solution" but I did´t find one.</p>