Jquery .live works but not with .datepicker

前端 未结 4 902
梦谈多话
梦谈多话 2020-12-03 04:05

Thanks for looking, all sincerely helpful answers are up-voted. I have some date input fields that are there when the page loads and a bunch that get generated dynamically.

4条回答
  •  一向
    一向 (楼主)
    2020-12-03 04:37

    This is what I ended up using. It takes advantage of live and focus in newer jQuery

    $.datepicker.setDefaults({ dateFormat: 'yy-mm-dd', ... });
    $('input.date').live('focus', function() {
        $(this).datepicker().datepicker('show');
        true;
    });
    

提交回复
热议问题