Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery datepicker only works once and is not shown the second time
    primarykey
    data
    text
    <p>ASP.NET MVC3 / jQuery 1.9.1 / jQuery UI 1.10.2</p> <p>I've got a page on which I open a modal dialog after clicking on an <code>Ajax.ActionLink</code>. Inside this dialog I have an input field and a <code>datepicker</code> associated with it. When I open the dialog for the first time, I can click on the datepicker button (or inside the associated input field so it receives focus, <code>showOn</code> is set to <code>both</code>), and the datepicker shows as expected. I can, while the modal dialog is open, do it as often as I want to, the datepicker shows every time. When I close the modal dialog (via an attached <code>$("ui-widget-overlay").click(function(){...});</code> and then open it again, the datepicker no longer works, no matter whether I try to click on the button or into the associated input field.</p> <p>I tried to debug the jQuery code, and both times the lines of code being run are the same (and even though the datepicker doesn't show up the second time the dialog is opened, the jQuery methods are triggered) from what I can see in the debugger. I'm completely stumped, and the methods described in <a href="https://stackoverflow.com/questions/2682259/jquery-ui-datepicker-not-displaying">this post</a> only helped in terms of being to show the datepicker the first time the dialog opens. <a href="https://stackoverflow.com/questions/13494926/jquery-datepicker-does-not-show-the-second-time">Another post</a> only seems to be related to a misunderstanding how the <code>showOn</code> setting works.</p> <p>I also tried to destroy the datepicker via <code>$("#datepicker").datepicker("destroy");</code> when closing the dialog - to no avail. Any ideas?</p> <p><strong>Update</strong></p> <p>On the "calling page":</p> <pre><code>$(document).ready(function () { $("#popupDialog").dialog( { autoOpen: false, modal: true, open: function() { $("ui-widget-overlay").click(function() { $("#popupDialog").dialog("close"); } } }); }); [...] @Ajax.ActionLink( "Some text", "Action", "Controller", new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "popupDialog", InsertionMode = InsertionMode.Replace, OnSuccess = "openPopup()" }) [...] function openPopup() { $("popupDialog").dialog("open"); } [...] &lt;div id="popupDialog" style="display: none;"&gt;&lt;/div&gt; </code></pre> <p>The controller action is very simple and as follows:</p> <pre><code>public ActionResult Action() { MyActionModel myActionModel = new MyActionModel(); return PartialView( myActionModel ); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    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