Jquery Appended Content - Not Clickable

前端 未结 1 890
借酒劲吻你
借酒劲吻你 2021-01-26 00:17

I have the following JQ. It\'s basically adding a little icon that will allow for some inline editing when a list item is selected. However, I am unable to work with the jquery

相关标签:
1条回答
  • 2021-01-26 00:50

    you need delegated event as html is dynamically added after DOM load:

    $(".k-state-focused").on("click", "a#EditWindow", function (e) {
      console.log("Asdf");
      $.get("ClassificationEditEntity", function(data) {
        $(".k-window-content").html(data);
      });
    });
    

    or:

    $(document).on("click", "a#EditWindow", function (e) {
          console.log("Asdf");
          $.get("ClassificationEditEntity", function(data) {
            $(".k-window-content").html(data);
          });
        });
    

    See HERE at the last of the page details of delegated events.

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