title: How to count the number of words in a Contenteditable div in real time?
body: <pre><code>&lt;div class="text" id="text" contenteditable="true"&gt;&lt;/div&gt;
  
  &lt;div class="words"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Whenever the user types into the <code>div</code> 'text', how would I make it so that the number of <strong>words</strong> entered get displayed into the <code>div</code> 'words'.</p>
  
  <p>I want this to be in real time - no page refreshing.</p>
  
  <p>I,e.</p>
  
  <pre><code>&lt;div class="text" id="text" contenteditable="true"&gt;Hello world!&lt;/div&gt;
  
  &lt;div class="words"&gt;2&lt;/div&gt;
  </code></pre>