First of all this is how the script works: jsfiddle
So, I want to make the plugin to search through images (thumbnails) by a attribute like “title” for example or something else.
Here is my markup : http://jsfiddle.net/dynamyc/KqCP5/embedded/result/
I can’t make the script to search through that images, I know something is wrong, maybe I didn’t put the correct path for
‘searchList’ : ‘home_proj li’,
‘searchItem’ : ‘img’
The code below will activate the plugin:
$(document).ready(function(){
$('.searchFilter').simpleContentSearch({
'active' : 'searchBoxActive',
'normal' : 'searchBoxNormal',
'searchList' : 'home_proj li',
'searchItem' : 'img'
});
});
The ‘searchList’ setting specifies the content that will be searched. In this case it is searchable tr. Finally, the ‘searchItem’ setting allows to dive in and specify an individual element to search. In this case, I use ‘td’.
Hope you understand what I’m trying to achieve.
Change
'searchList'to'home_proj ul li'and
'searchItem'to'a'seems working.For example, try
title="abc"and search “abc”First,
'searchList'is the common type of the DOM object you want to filter.So in your second markup, when you want to search a list of
<a>, then you should set'searchList'as'jThumbnailScroller a'Second,
'searchItem'is the part of the DOM object you want to search on. The way this plugin does it, is that it searches the DOM object’shtml(), however if you want to search on<img>, it’s not gonna work because itshtml()is empty. So if you really want to search on<img>title, you should set'searchItem'as'img', and change this part of the pluginif (!elem.html().match(new RegExp('.*?' + query + '.*?', 'i')))to
if (!elem.attr('title').match(new RegExp('.*?' + query + '.*?', 'i')))