jQuery event handler .on() not working

前端 未结 6 1235
小鲜肉
小鲜肉 2020-12-08 09:49

I want to attach a event to dynamically created element class.So i used live function but it was not triggered. So checked live function reference ,there i red below notes

6条回答
  •  执念已碎
    2020-12-08 10:08

    try :

    $(document.body).on( "click", ".date_picker_disabled", function() {   
       alert('hi');
    });
    

    document.body helps for dynamic html too. Just chekc it out: .on not working on dynamic html

提交回复
热议问题