Binding dynamically added elements in jQuery mobile

后端 未结 1 1360
灰色年华
灰色年华 2020-12-04 04:15

I\'m trying to delete some list elements after dynamically adding them.

The idea is that you can update the list, and then after updating it you can click on a list

1条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 04:42

    The correct way to bind events to dynamically added items is as follows.

    $(document).on("event", ".selector", function () {
      $(this).remove();
      $('ul_selector').listview('refresh');
    });
    

    0 讨论(0)
提交回复
热议问题