Making datepicker live - JQuery

后端 未结 4 756
故里飘歌
故里飘歌 2021-01-12 09:48

I know when you create an element dynamically, you have to use something like:

$(\"#id\").live(\"click\", function() {
    //something
});

4条回答
  •  庸人自扰
    2021-01-12 10:07

    I think that more proper solution is:

    $('input.datepickerClass').live('focus', function(){
        if (false == $(this).hasClass('hasDatepicker')) {
            $(this).datepicker({ options });
        }
    });
    

提交回复
热议问题