嗨,我有一个JQuery函数,它可以创建一个弹出对话框,你必须点击它才能继续,然而,当这个框弹出,一切正常时,链接不会触发php链接。
下面是JQuery代码:
jQuery('.delete-row').click(function () {
var conf = confirm('Continue delete?');
if (conf) jQuery(this).parents('tr').fadeOut(function () {
jQuery(this).remove();
});
return false;
});下面是我的代码,它调用对话框,并将php信息传递给block.php页面:
echo "<a href=\"block.php?ip_address={$ip_address}&id={$id}&userna={$username1}\" class='delete-row' data-original-title='Delete'>Block</a>";发布于 2013-05-22 00:09:01
您可以尝试:
jQuery(document).on('click', '.delete-row', function () {
var conf = confirm('Continue delete?');
if (conf){ jQuery(this).parents('tr').fadeOut(function () {
jQuery(this).remove();
});
return true;
}
return false;
})发布于 2013-05-22 00:08:45
看起来你的函数总是返回false :这阻止了事件被处理。
您应该返回true if (conf),否则返回false。
jQuery('.delete-row').click(function () {
var conf = confirm('Continue delete?');
if (conf) {
jQuery(this).parents('tr').fadeOut(function () {
jQuery(this).remove();
});
return true;
}
// else...
return false;
});https://stackoverflow.com/questions/16674449
复制相似问题