Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome $(此)。删除不在chrome中工作_Google Chrome_Jquery - Fatal编程技术网

Google chrome $(此)。删除不在chrome中工作

Google chrome $(此)。删除不在chrome中工作,google-chrome,jquery,Google Chrome,Jquery,$(this).remove()在所有浏览器中都能正常工作,但在Chrome中不起作用。我使用这个函数来删除一个图像,它实际上删除了那个特定的图像div,但是chrome仍然显示那个图像。若我最小化窗口,然后最大化,chrome将不会显示删除的图像 编辑:(摘自评论) Html 这段代码在我在chrome中测试时也能正常工作 $(function() { $("div.image_holder").click(function() { $(this).remove(); //o

$(this).remove()
在所有浏览器中都能正常工作,但在Chrome中不起作用。我使用这个函数来删除一个图像,它实际上删除了那个特定的图像div,但是chrome仍然显示那个图像。若我最小化窗口,然后最大化,chrome将不会显示删除的图像

编辑:(摘自评论)

Html


这段代码在我在chrome中测试时也能正常工作

$(function()
 {
 $("div.image_holder").click(function()
 {
   $(this).remove();
   //or
   //$(this).hide();
 });
});

它没有给我任何问题,这是非常基本的方法,您通过单击父对象本身来删除
parent()
。因为在包含图像的案例中,图像的父对象是div。

Uhh@ExplosionPills-我已经在使用这个函数,它也在工作,但chrome没有清除缓存中的图像,它仍然显示该图像为可见。你能给我们显示你正在使用的实际代码吗?这是我的HTML代码保存图像:$(“.image_holder”).live(“单击”,函数(){$(this.parent.remove();});这将删除div,但仍然显示图像它应该是
$(This.parent().remove()
而不是
$(This.parent.remove()
您是否检查了我提到的链接?是的,我检查了。我使用相同的函数和代码。但chrome的缓存无法运行。图像已被删除,但不会离开chrome缓存。请清除浏览器缓存,然后多次使用
ctrl+r
ctrl+f5
。奇怪的是它还在缓存中。此外,我无法复制你说的话。
$(".image_holder").live("click", function() { $(this).parent.remove(); });
$(function()
 {
 $("div.image_holder").click(function()
 {
   $(this).remove();
   //or
   //$(this).hide();
 });
});