DatePicker not working in ajax loaded page

后端 未结 3 964
深忆病人
深忆病人 2021-01-15 07:28

I attach the datepicker to inputs in a global script file with like this:

$(document).on(\"focusin\",\".datePick\", function () {
            $(this).datepic         


        
3条回答
  •  Happy的楠姐
    2021-01-15 08:17

    Using live, delegate, or on does not work with jQuery UI widgets because they are stateful plugins that must be instantiated after the necessary DOM nodes exist.

    You can accomplish what you're looking for though by instantiating the datepicker after the additional markup has been injected. Here's an example doing so - http://jsfiddle.net/tj_vantoll/qN8dG/2/.

提交回复
热议问题