This is some event handling for a list of items in my dom.
Using event delegation, the click handler is on the parent container
$( "#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);
});
Any ideas? Any help is appreciated.