jQuery datepicker only works once and is not shown the second time

后端 未结 10 1213
庸人自扰
庸人自扰 2021-01-02 06:32

ASP.NET MVC3 / jQuery 1.9.1 / jQuery UI 1.10.2

I\'ve got a page on which I open a modal dialog after clicking on an Ajax.ActionLink. Inside this dialog

相关标签:
10条回答
  • 2021-01-02 06:58

    btw i will try to explain the way i solved it, cause i think is easier this way.

    im not an expert in this matters, so forgive me if I do not use the correct terms to explain it.

    if u have 2 places in the same page u want to load datepicker, u got to duplicate the function:

    $(function() {
        $( "#datepicker" ).datepicker({
          showOn: "button",
          buttonImage: "images/calendar.png",
          buttonImageOnly: true,
          buttonText: "Select date",
          addClass:".ccCFcalV2"
        });    
    });       
    
    $(function() {
        $( "#datepicker2" ).datepicker({
          showOn: "button",
          buttonImage: "images/calendar.png",
          buttonImageOnly: true,
          buttonText: "Select date",
          addClass:".ccCFcalV2"
        });
    });
    

    and add the class "datepicker2" to the second place u want to call the datepicker. it works, almost for me

    Hope it helps someone, if u consider this a dumb solution, let me know and i'll remove it

    have a nice day!

    0 讨论(0)
  • 2021-01-02 07:00

    You can do this by adding a new function to div onclick="focusBlur()"

    <script>
        function focusBlur() {
            $('input').blur();
        }
    </script>
    
    0 讨论(0)
  • 2021-01-02 07:08

    initialize the datepicker on ajax success method.

    0 讨论(0)
  • 2021-01-02 07:12

    If you need to show more than one time in the same view the calender and it only show's one time try this:

    document.getElementById("div_Validade").onclick = function () { SetZIndex() };
    
    function SetZIndex() {
        document.getElementById("ui-datepicker-div").style.zIndex = "999999";
    }
    

    div_Validade corresponds to the div id where the input is placed,

    ui-datepicker-div is infragistics element that is not shown.

    0 讨论(0)
提交回复
热议问题