有人可以告诉我如何使用jquery删除和隐藏事件吗?实际上目前我已经使用了jquery bellow和它的工作正常,但它只是删除了事件但没有隐藏它,请你能为我修改它吗?
function delData(id){
if(confirm('Do you really want to delete it ? if yes then click OK and wait for next notification please.. ')){
$.ajax({
type:'POST',
url:'manage_reports.php?action=del&id='+id,
success:function(result){
alert('Sale has been deleted successfully.. Do not refresh your page if you want to keep stay here');
$(control).parents('table').eq(0).remove().hide("table");
}
});
}
};
非常感谢
答案 0 :(得分:1)
您不能hide
删除的项目只使用hide
或remove
,如果您想删除其他元素,请单独执行。 hide不接受您可能尝试传递的选择器,它接受一个参数但其选项不是选择器。
function delData(id){
if(confirm('Do you really want to delete it ? if yes then click OK and wait for next notification please.. ')){
$.ajax({
type:'POST',
url:'manage_reports.php?action=del&id='+id,
success:function(result){
alert('Sale has been deleted successfully.. Do not refresh your page if you want to keep stay here');
$(control).parents('table').eq(0).remove();
}});
}};
答案 1 :(得分:0)
如果通过说“删除事件”你的意思是让“鼠标点击”这样的事件处于非活动状态,那么我建议你首先使用bind创建/绑定该事件或在元素上使用
完成ajax请求后,只需删除/隐藏元素,并在其上调用.unBind('event')。