innerText shows content but doesn't allow me to change it
<p>I have a JS function activating after an onclick event on an A tag. Here is the code :</p>

<pre><code>(function(MTM) {
  MTM.selectAllNone = function(e) {
    var string = e.target.textContent || e.srcElement.innerText;
    var list = document.getElementById('my-div');
    var inputs = list.getElementsByTagName('input');
    var length = inputs.length;
    if (string == 'Select all') {
      for (var i=0; i&lt;length; i++) {
        if (inputs[i].getAttribute('type') == 'checkbox') {
          inputs[i].setAttribute('checked', 'checked');
        }
      }
      string = 'Select none';
    }
    else {
      for (var i=0; i&lt;length; i++) {
        if (inputs[i].getAttribute('type') == 'checkbox') {
          inputs[i].removeAttribute('checked');
        }
      }
      string = 'Select all';
    }
  };
}(window.MTM = window.MTM || {}));
</code></pre>

<p>And on the A tag, here it goes :</p>

<p><code>&lt;a href="javascript:void(0);" onclick="MTM.selectAllNone(event);"&gt;Select all&lt;/a&gt;</code></p>

<p>Now, while debugging, I can see that "string" contains the text "Select all". It goes well through the <code>if (string == 'Select all')</code>. And the line <code>string = 'Select none';</code> does change the string variable. But it doesn't change the text of the anchor tag.</p>

<p>Maybe something obvious?</p>
