ggalan
01-31-2011, 10:41 PM
i have a jquery loop that looks like this.
var tagsArr=new Array();
$('.thumb_tag').each(function(){
var htmlStr = $(this).html();
$(htmlStr).find('a').each(function(){
tagsArr.push($(this).html().toLowerCase());
});
});
the line: tagsArr.push($(this).html().toLowerCase());
will find all 'a' elements of this loop and display it
my question:
how can i set a "filter" so that i can do something like this
if ($(htmlStr).find('a').match(/\bdesign\b/)){ // the \b is a word boundary and the word i want to only output is design
tagsArr.push($(this).html().toLowerCase());
}
var tagsArr=new Array();
$('.thumb_tag').each(function(){
var htmlStr = $(this).html();
$(htmlStr).find('a').each(function(){
tagsArr.push($(this).html().toLowerCase());
});
});
the line: tagsArr.push($(this).html().toLowerCase());
will find all 'a' elements of this loop and display it
my question:
how can i set a "filter" so that i can do something like this
if ($(htmlStr).find('a').match(/\bdesign\b/)){ // the \b is a word boundary and the word i want to only output is design
tagsArr.push($(this).html().toLowerCase());
}