Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get all options of jquery datepicker to instanciate new datepicker with same options?
    text
    copied!<p>How to get all options of jquery datepicker to instanciate new datepicker with same options?</p> <p>I want clone a table which contains 2 datepickers with different options. You can see here an example : <a href="http://jsfiddle.net/qwZ5x/4/" rel="noreferrer">http://jsfiddle.net/qwZ5x/4/</a></p> <pre class="lang-html prettyprint-override"><code>&lt;div class="clonable"&gt; &lt;table&gt;&lt;tr&gt;&lt;td&gt; &lt;input type="text" id="datepicker" /&gt; &lt;script&gt; jQuery(document).ready(function() { jQuery("#datepicker").datepicker({ showOn: "both", buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif" }); }); &lt;/script&gt;&lt;/td&gt;&lt;td&gt; &lt;input type="text" id="datepicker2" /&gt; &lt;script&gt; jQuery(document).ready(function() { jQuery("#datepicker2").datepicker(); }); &lt;/script&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;/div&gt; &lt;a href="javascript:void(0);" id="clone"&gt;Clone&lt;/a&gt; </code></pre> <pre class="lang-js prettyprint-override"><code>var id = 0; jQuery("#clone").on("click", function () { var clonable = jQuery(".clonable:first").clone(true, true); jQuery(clonable).find("input").each(function () { jQuery(this).attr("id", jQuery(this).attr("id") + "_" + id); jQuery(this).siblings('.ui-datepicker-trigger,.ui-datepicker-apply').remove(); jQuery(this).removeClass('hasDatepicker'); jQuery(this).datepicker({ showOn: "both", buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif" }); }); jQuery(clonable).insertBefore("#clone"); id = id + 1; }); </code></pre> <p>How can i set all options to cloned datepicker without set option one by one?</p> <p>Thank you very much.</p>
 

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