Making datepicker live - JQuery

后端 未结 4 718
故里飘歌
故里飘歌 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:13

    According to: Jquery .live works but not with .datepicker

    This should work:

    $("#tdInput1").live("click", function(){
        $(this).datepicker({ 
            inline: true 
        });
    });
    

    edit: This answer is for older versions of jQuery. For jQuery 1.9+ please try Vishal's answer.

提交回复
热议问题