Reputation: 737
hi everyone i cant find the solution for my question on google. i just want to hide the images using there icon-value like in the below example i just want to hide the image which have icon-value="1" in the div which have .box class
<div class="box">
<div class="icon"><img src="xyz/smiley.png" icon-value="1" icon-index="0"></div>
<div class="icon"><img src="xyz/1.png" icon-value="2" icon-index="1"></div>
</div>
Upvotes: 0
Views: 98
Reputation: 608
using css try following
.box .icon img[icon-value="1"] {
display: none;
}
or if you are using jquery you can try this also
$(".box img[icon-value=1]").hide();
Upvotes: 2
Reputation: 782785
use an attribute selector.
.box img[icon-value="1"] {
display: none;
}
Upvotes: 5
Reputation: 15736
CSS solution:
.box img[icon-value="1"] {
display: none;
}
PS: Notice the value in quotes. I don't think CSS attribute selectors will work if the value is not specified in quotes
jQuery solution:
$(".box img[icon-value=1]").css("display", "none");
Upvotes: 2