jQuery event handler .on() not working

前端 未结 6 1237
小鲜肉
小鲜肉 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:22

    Maybe you should do:

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

    in this way you attach the event handler to the bosy and specify to fire that event only when that selector ".date_picker_disabled" is matched.
    BTW this is exactly how live() worked

提交回复
热议问题