title: With Javascript, how to read what is within <span> tags, when the value is created by Javascript
body: <p>I have this code and I basically want it to read what is created in between the <code>&lt;span&gt;</code> tags (that value is created by another javascript script), and then take that to display 'article' or 'articles'. </p>
  
  <pre><code>&lt;span id="quantity" class="simpleCart_quantity"&gt;&lt;/span&gt;
  
  &lt;script type="text/javascript"&gt;
  var q = document.getElementById('quantity');
  
  if (q == 1) {
      document.write("article");
  }
  else
    {
    document.write("articles");
    }
  &lt;/script&gt; 
  </code></pre>
  
  <p>So I want it to check <code>&lt;span id="quantity" class="simpleCart_quantity"&gt;&lt;/span&gt;</code>, and if the value that is present is '1', write 'article' and if the value is '0' or more than '1' write 'articles'. I hope you can get it.</p>
  
  <p>Now it works, but only if you actually write something in between the <code>&lt;span&gt;</code>, like: 
      1</p>
  
  <p>But the value is created externally and the script must be able to read the value that is created when the page is loaded right?</p>
  
  <p>The result should be a sentence that says 'You have x article(s) in your shopping cart'.</p>
  
  <p>I have no idea of how I should do this, I hope somebody can help me.</p>
  
  <p>Thanks a lot!</p>