Undefined Error when looking in Debug, trying to create DIV
<p>I am trying to execute the javascript below and I am getting an undefined error. I am just trying to create a div with some text and place it before a span tag when the page loads.. I could be totally off base with my code though: </p>

<pre><code>&lt;script type = "text/javascript"&gt;
function MMinsertPhoneinheader() {
     var div = document.createElement('div');
     div.innerHTML = ("&lt;span&gt; &lt;p&gt; Get Detailed Pricing &lt;/p&gt; &lt;br&gt; &lt;p&gt; &lt;b&gt; (866)682-7927 &lt;/b&gt;&lt;/p&gt; &lt;/span&gt;");
     div.setAttribute('class', 'cust');
     document.getElementsByTagName('span')[5].appendChild(div);
     break;
};
MMinsertPhoneinheader();
&lt;/script&gt;
</code></pre>

<p>Any help would be life saving. Sorry for the noob question. Thanks!</p>

<p>Here is the new code: </p>

<pre><code>&lt;script language="javascript"&gt;
function MMinsertPhoneinheader() {
  var div = document.createElement('div');
  div.innerHTML = ("&lt;span&gt; &lt;p&gt; Get Detailed Pricing &lt;/p&gt; &lt;br&gt; &lt;p&gt; &lt;b&gt; (866)682-7927 &lt;/b&gt;&lt;/p&gt; &lt;/span&gt;");
   div.setAttribute('class', 'cust');
   document.querySelector(".toplinks").appendChild(div);
 };
MMinsertPhoneinheader();
&lt;/script&gt;
</code></pre>

<p>I am getting the Syntax Error on line 3. </p>

<pre><code>var div = document.createElement('div');
</code></pre>
