I have a very simple test here:
var cells = document.querySelectorAll('textarea#test');
        for (var i = 0, il = cells.length; i < il; i++) {
          cell = cells[i];
          cell_contents = cell.innerHTML;
          console.log(cell_contents);
        }<form>
  <textarea id="test" style="width:600px;">
    <script>
  </textarea>
</form >The console.log shows:
<script>
I can't work out why that is? I'd like to know if the textarea contains HTML using Javascript, but whenever I check the contents of it, the HTML is always encoded.
I had a look at this SO question: does <textarea> auto-encode inner html?
But am none the wiser.
 
    