javascript - jquery function applying css to image -
well code:
(function($) { var images = $( "img" ); $("div.featured-card-box").find(images)[1].css("display", "none"); });
it supposed apply css image doesn't work , i'm new have no idea what's wrong. big answers!
your code looks little more complicated necessary:
1) note jquery [1] second image because starts counting @ 0. dom object instead of jquery one, not able use jquery methods on (like trying do).
2) jquery, can access images using same method css selectors:
$("div.featured-card-box img")[1]
assuming want second image in div class of "featured-card-box" hidden, should trick:
$("div.featured-card-box img:eq(1)").hide();
although, equally replace .hide()
.css('display','none')
edit: here's fiddle: https://jsfiddle.net/vf8d9ske/
Comments
Post a Comment