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

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -