当您单击一个元素时,我无法触发事件,并且该元素仅在您悬停 td 元素时显示。
//Hovering over a td element displayed a Span
$('td').hover(
function() {$(this).append('<span class="editCell">hello</span>')},
function() {$(this).find('span:last').remove()}
)
//Clicking on that span, it's supposed to trigger alert. But it doesn't.
$('.editCell').click( function(){
alert('hello');
})