How to bind jQuery Datepicker after Ajax refresh?

前端 未结 4 600
误落风尘
误落风尘 2021-01-14 04:44

I\'ve got a jQuery datepicker that is working great for me, except when I fresh the content via ajax, I lose the datepicker. From what I can tell I should be using jQuery on

4条回答
  •  悲哀的现实
    2021-01-14 05:25

    I've got a similiar problem: After an ajax page reload I can't set new datepicker with $(element).datepicker(). Because Datepicker only does once a clean initialization, I just set directly after ajax success:

    $.datepicker.initialized = false;
    

    Now the next $(element).datepicker() will cause a fresh initialization. This affects all datepicker on the side, so you may have reset datpicker outside the ajax-container.

提交回复
热议问题