title: Append a script into a div
body: <p>I've got a little problem and I'm stucking on it for a couple of days.
  I downloaded a <code>Javascript</code>calendar plugin (<a href="http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm" rel="nofollow noreferrer">Date Input</a>) to add a little calendar in my form.
  In this form I added a button wich add another line in this form to let user set severals dates.</p>
  <pre><code>&lt;input type=&quot;button&quot; value=&quot;Ajouter&quot; onclick=&quot;ajoutChamp('creneau')&quot; /&gt;
  </code></pre>
  <p>I made a little script :</p>
  <pre><code>var s = document.createElement('script');
  s.type = &quot;text/javascript&quot;;
  s.text = &quot;DateInput('creneau_2',true,'DD-MON-YYYY')&quot;;
  $(&quot;#test&quot;).append(s);
  </code></pre>
  <p>But when I'm doing this, every time I press the button I've got my calendar who appears fullscreen. It's look like the script has been executed but no appened in the html page.</p>
  <p>Little piece of my html code :</p>
  <pre><code>&lt;table id=&quot;liste_creneau&quot; class=&quot;add_champ&quot;&gt;
      &lt;tr id=&quot;tr_creneau_1&quot;&gt;
          &lt;td&gt;&lt;label for=&quot;creneau_1&quot;&gt;creneau 1&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;&lt;script id=&quot;ref_date&quot;&gt;DateInput('creneau_1', true, 'DD-MON-YYYY')&lt;/script&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;div id=&quot;test&quot;&gt;
  
  &lt;/div&gt;
  </code></pre>
  <p>Atm I wanted to append the calendar in a div but at the end the calendar will be in the table.</p>
  <p>I have done other tests too but every piece of code I made ended the same way...</p>
  <p>So maybe you could help me! :)</p>
  <p><strong>Edit:</strong></p>
  <p>Ok I made a little test</p>
  <pre><code>var g = document.getElementById('test');
  var s = document.getElementById('ref_date');
  nb++;
  var clone = s.cloneNode(true);
  var param = clone.firstChild.data.split('\'');
  param[1] = 'creneau_'+nb;
  clone.firstChild.data = param.join('\'');
  g.appendChild(clone);
  </code></pre>
  <p>After that, when I click on the button, there is a script tag inserted in the div but nothing shows up. When I inspect my html page I can see it but the calendar doesn't apear...</p>
  <p>Bye</p>
  <p>Edouard</p>