i have a little problem with .search
this is the code
// filter - posts
jQuery('.filter_by').live('click',function(){
var target_fi = jQuery(this);
var target_cat = target_fi.parents('.cat').children('.namechanger').val();
target_fi.next().fadeIn(100);
var cat_all = target_fi.prev().find("option").each(function(i){
if(jQuery(this).attr('data-cats').search(target_cat) == -1){
jQuery(this).css({"display":"none"});
}
});
});
I want to use the variable target_cat with .search
I can't do this .search(/target_cat/)
new RegExp(target_cat)