I have the HTML below
<span class="post-labels">
<a href="http://myblog.blogspot.com/search/label/jQuery%20Downloads">jQuery Donwloads</a>
<a href="http://myblog.blogspot.com/search/label/jQuery">jQuery</a>
<a href="http://myblog.blogspot.com/search/label/mootools">mootools</a>
<a href="http://myblog.blogspot.com/search/label/css">css</a>
<a href="http://myblog.blogspot.com/search/label/blogger">blogger</a>
<a href="http://myblog.blogspot.com/search/label/wordpress">wordpress</a>
</span>
the jquery below adds class to <a> elements ACCEPT for the url http://myblog.blogspot.com/search/label/jQuery%20Downloads http://jsfiddle.net/qbrN8/10/
$(".post-labels a").each(function(){
var domain = "http://myblog.blogspot.com/search/label/";
var dontadd = "jQuery Downloads";
var encode = encodeURI(dontadd);
var url = domain + encode;
var posta = $(this).attr("href");
if(posta!=url){
$(this).addClass("addedclass");
}
});
I am trying to create an array to exclude multiple specified urls with the jquery below BUT it doesn't work http://jsfiddle.net/qbrN8/11/ .... I never have worked with arrays so i wouldn't know how to fully execute it. i have search but i keep getting result of stuff like var myarray[0] var myarray[1] where i would much rather have an array like var myarray = [];
$(".post-labels a").each(function(){
var domain = "http://myblog.blogspot.com/search/label/";
var dontadd = [];
dontadd.push("jQuery Downloads", "css", "wordpress");
var encode = encodeURI(dontadd);
var url = domain + encode;
var posta = $(this).attr("href");
if(posta!=dontadd){
$(this).addClass("addedclass");
}
});