title: How do you write to a span using jQuery?
body: <p>I'm trying to populate a <code>&lt;span&gt;&lt;/span&gt;</code> element on the page load with jQuery.</p>
  
  <p>At the moment the value that gets populated into the span is just an integer count.</p>
  
  <p>Here I have named my span <em>userCount</em>:</p>
  
  <pre><code>&lt;a href="#" class=""&gt;Users&lt;span id = "userCount"&gt;&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p>I am trying to write the value of the span with no success.</p>
  
  <pre><code>$(document).ready(function () {
      $.post("Dashboard/UsersGet", {}, function (dataset) {
          var obj = jQuery.parseJSON(dataSet);
          var table = obj.Table;
  
          var countUsers;
          for (var i = 0, len = table.length; i &lt; len; i++) {
              var array = table[i];
              if (array.Active == 1) {
                    var name = array.Name;
              }
              countUsers = i;
          }
          userCount.innerHTML = countUsers.toString();
      });
  });
  </code></pre>