Im trying to get my Array Entires inside a jQuery-Code which is inside a for-loop.
var list = ["name1", "name2" ];
for (var i = 0; i < list.length; i++)
{
$('ul.list li a[href*=(ary[i])]').parent().hide();
}
Im stuck and need help, thanks in advance!
BTW: This code is for a Greasemonkey Userscript (Firefox).
$('ul.list li a[href*="name"]').parent().hide();
works just fine. But with a couple hundret "names" I dont want to repeat this line all the time like this
$('ul.list li a[href*="name1"]').parent().hide();
$('ul.list li a[href*="name2"]').parent().hide();
[...]
$('ul.list li a[href*="name492"]').parent().hide();
EDIT: To avoid misunderstanding, in action the array would be not ["name1, "name2"] but something random like ["red", "banana", "pacific"]
list.lenghtshould belist.length? Do you get any errors in your javascript console?[href*=(ary[i])]won't work = needs to be[href="' + list[i] + '"]