这是对我家中物品清单的一些事件处理。
使用事件委托,点击处理程序位于父容器上
$( "#list" ).on( "click","a",(event) => {
event.preventDefault();
event.stopImmediatePropagation();
let text = $(this).parent().children().last().text();
// The following HAS content (seen in the dev tools debugger !!!!)
// $(this).parent().children().last().text()
// But the text variable gets No content - WHY ?
// "" is printed....
console.log(text);
});
有什么想法吗?任何帮助表示赞赏。