This will give you all DIVs which have background-image set: $('div').filter(function(){ return !!this.style.backgroundImage; })
If you need to filter by extension or something use indexOf, it's faster than a regex: $('div').filter(function(){ return this.style.backgroundImage.indexOf('.png') > -1; }) cheers, - ricardo On Feb 25, 6:15 am, "David .Wu" <chan1...@gmail.com> wrote: > I made a function, but I hope I can do it by jquery selectors. > > $(function() { > $('div').each(function() { > var $bk = $(this).css('background-image'); > if ($bk.match('png')) { > console.log('yes'); > } else { > console.log('no'); > } > }); > }); > > On 2月25日, 下午12時53分, "David .Wu" <chan1...@gmail.com> wrote: > > > I have hundred or css class need that, I am afraid that it's better to > > search which has the property. > > > On 2月25日, 下午12時18分, Steven Yang <kenshin...@gmail.com> wrote: > > > > according to your case > > > use$(".box") > > > or > > > $("div .box") > > > since all elements with class "box" will have background image