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')
listfilter
function, don't have elementid
. - you're calling
$(list)
within function body, you've passedlist
jquery object, there's no need wrap again. - you're looking
anchors
contain given string, don't haveanchors
within list (you haveimages
). - there's no need custom
:contains
selector if need check if string contained withinsrc
ofimage
(you can use attribute contains selector).
Comments
Post a Comment