Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had a slight problem with the order that you ran it in, so I changed a few things. I ran this in <a href="http://jsfiddle.net/JonathanBates/rcpNH/" rel="nofollow">jsFiddle</a>:</p> <p>I used this html:</p> <pre><code>&lt;link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/redmond/jquery-ui.css" rel="stylesheet" /&gt; &lt;div style="display:none" id="dd"&gt; &lt;div id="d1"&gt;&lt;/div&gt; &lt;/div&gt; &lt;button data="1"&gt;1&lt;/button&gt; &lt;button data="2"&gt;2&lt;/button&gt; </code></pre> <p>The buttons are just used to trigger the code</p> <p>I used the following script:</p> <pre><code>jQuery(document).ready(function(){ jQuery("button").click(function(){ test(jQuery(this).attr("data")); }); }); var sdate, text function test(x) { if (x == '1') { $('#d1').datepicker({ onSelect: function() { sdate = $(this).val(); $("#dd").dialog("close"); text = 'THE DATE YOU HAVE CHOSEN IS: '+ sdate +'.'; alert(text); //jQuery(this).datepicker("destroy"); }//end of onSelect: function() { });//end of datepicker $('#dd').dialog({ autoOpen: true, modal: true, overlay: { opacity: 1.0, background: 'black' }, title: "SELECT DATE 1...", height: 400, width: 400, draggable: false, resizable: false}); } else if (x == '2') { $('#d1').datepicker({ onSelect: function() { sdate = $(this).val(); $("#dd").dialog("close"); text = 'THE 2ND DATE YOU HAVE CHOSEN IS: '+ sdate +'.'; alert(text); //jQuery(this).datepicker("destroy"); }//end of onSelect: function() { });//end of datepicker $('#dd').dialog({ autoOpen: true, modal: true, overlay: { opacity: 1.0, background: 'black' }, title: "SELECT DATE 2...", height: 400, width: 400, draggable: false, resizable: false}); }//end of (x == '2') }//end of function </code></pre> <p>The only problem I had getting it to work was the order of operations. So I create the datepicker before I create the dialog.</p>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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