Jquery 无法取消隐藏单个图像
我是jquery新手,我想请求您支持如何从另一个div中取消隐藏单个图像。因为我隐藏了所有标记的Jquery 无法取消隐藏单个图像,jquery,Jquery,我是jquery新手,我想请求您支持如何从另一个div中取消隐藏单个图像。因为我隐藏了所有标记的,我想取消隐藏单个图像以便于描述。为您的图像提供Id并取消隐藏它 <img id="image1" src="...."/> $('#image1').show() $('#image1').show() 您可以使用下面的代码片段 $("#imageDivId").show(); 您还可以使用div class而不是id $(".imageDivClass").show();
,我想取消隐藏单个图像以便于描述。为您的图像提供Id并取消隐藏它
<img id="image1" src="...."/>
$('#image1').show()
$('#image1').show()
您可以使用下面的代码片段
$("#imageDivId").show();
您还可以使用div class而不是id
$(".imageDivClass").show();
还可以使用toggle()方法在hide()和show()方法之间切换
如果使用ID可以使用
$(“#img_ID”).show()代码>
如果使用类可以使用$('.img_class').show()代码>
如果使用ID为的父div作为目标img,则可以使用$(“#div_ID img”).show()代码>
对于jQuery,您也可以使用jQuery来显示/隐藏img,具体取决于它是否可见。您需要指定需要显示的图像:
<img src="http://placehold.it/50x50" />
<img src="http://placehold.it/50x50" />
<img src="http://placehold.it/50x50" />
<div id="show"><img src="http://placehold.it/50x50" /></div>
$('img').hide();
$('#show img').show();
$('img').hide();
$('#show img').show();
Fiddle:HTML是什么样子的。以及隐藏图像的代码。你可以说类似于$('#yourmageid').show()的话代码>为了帮助您,请提供您的代码以及您在JSFIDLE上尝试过的内容和/或演示。其中一些答案对您有用吗?
<img src="http://placehold.it/50x50" />
<img src="http://placehold.it/50x50" />
<img src="http://placehold.it/50x50" />
<div id="show"><img src="http://placehold.it/50x50" /></div>
$('img').hide();
$('#show img').show();