Jquery .on versus .live

前端 未结 4 478
梦谈多话
梦谈多话 2020-12-09 15:58

I know that .live() is now deprecated but I cannot seem to change it and keep the functionality.

I just have a quick question about the

4条回答
  •  心在旅途
    2020-12-09 16:27

    Ensure that the selected element (the th/tr) exists when the page is loaded initially. The new .on won't work if this selector is added later to the DOM.

    Try

    $('body').on('click', 'thesSelectorForYourTriggerElement', function(){
        //callback
    });
    

提交回复
热议问题