Note that there are some explanatory texts on larger screens.

plurals
  1. POAppend a script into a div
    primarykey
    data
    text
    <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">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="button" value="Ajouter" onclick="ajoutChamp('creneau')" /&gt; </code></pre> <p>I made a little script :</p> <pre><code>var s = document.createElement('script'); s.type = "text/javascript"; s.text = "DateInput('creneau_2',true,'DD-MON-YYYY')"; $("#test").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="liste_creneau" class="add_champ"&gt; &lt;tr id="tr_creneau_1"&gt; &lt;td&gt;&lt;label for="creneau_1"&gt;creneau 1&lt;/label&gt;&lt;/td&gt; &lt;td&gt;&lt;script id="ref_date"&gt;DateInput('creneau_1', true, 'DD-MON-YYYY')&lt;/script&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id="test"&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>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload