<分区>
谁能解释一下 event.preventDefault()
和 event.stopPropagation()
之间的区别?
我有一个表,在该表中我有一个 img 标签。
当我点击 img 标签时,我想看到一个弹出窗口。
但是我也想停止多行的选择,所以我使用:
$("table.items tbody tr").click(function(event) {
event.stopPropagation();
});
当我使用js代码时,弹窗没有出现;
如果我删除 js 代码,弹出窗口会工作。
$(".info").live("click",function(e){
//console.log('ok');
e.stopPropagation();
var elem = $(this);
var id = $(this).attr("id").replace("image_","container_");
$('#'+id).toggle(100, function() {
if($(this).css('display') == 'block') {
$.ajax({
url: "$url",
data: { document_id:elem.attr('document_id') },
success: function (data) {
$('#'+id).html(data);
}
});
}
});
});
为什么?