title: getElementById then calculate length
body: <p>A fairly easy question I assume, but I'm only a beginner and I'm struggling to work this out for myself and I can't seem to find the answer on google.</p>
  
  <p>I have a heading tag that I need to grab using javascript and then work out the length of, then edit the font size depending on the result.</p>
  
  <p>Why is my code not working?</p>
  
  <pre><code>var titleElement = document.getElementById("myelement");
  
  if(titleElement.length&gt;10){
  titleElement.style.fontSize = 16;
  }
  </code></pre>
  
  <h2>EDIT / ADDITION</h2>
  
  <p>I can't get it to work, even after your kind suggestion to add .innerHTML:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body onload="titleLengthShow()"&gt;
  &lt;h1 id="myelement"&gt;dfg adg earsh aaerg eaag erg aergethj5 yetfgg eg d&lt;/h1&gt;
  
  &lt;script type="text/javascript"&gt;
  
  function titleLengthShow(){
  var titleElement = document.getElementById("myelement");
  
      if(titleElement.innerHTML.length&gt;10){
          titleElement.style.fontSize = 16;
      }
  
  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>