jquery - How to search/filter by image source? -
i'm trying make page can filter source name of image.
i found script it's working on text: http://kilianvalkhof.com/2010/javascript/how-to-build-a-fast-simple-list-filter-with-jquery/
fiddle: jsfi ddle.net/svjrk/
what need filter image source? see: jsfi ddle.net/svjrk/1/
any advice great!
in answer question asked in title, attribute contains selector you're looking for:
$('img[src*="sport"]')
which select images, src property contains sport.
as question specifically, there number of issues:
- you're passing
$('#list')listfilterfunction, don't have elementid. - you're calling
$(list)within function body, you've passedlistjquery object, there's no need wrap again. - you're looking
anchorscontain given string, don't haveanchorswithin list (you haveimages). - there's no need custom
:containsselector if need check if string contained withinsrcofimage(you can use attribute contains selector).
Comments
Post a Comment