我正在尝试遍历所有作为类导航(.nav)后代的锚点并检查它们的内容。如果是任何一种情况,则将其内容替换为特定且相应的 unicode。
为什么这不起作用,有没有比我尝试过的更好的方法?
$(document).ready(function(){
var navigationLinks = $('.nav a');
for(var i=0; i < navigationLinks.length; i++){
var thisLink = navigationLinks[i];
switch(thisLink.html()){
case "About":
thisLink.replace(/About/g,'');
case "Work":
thisLink.replace(/Work/g,'');
case "CV":
thisLink.replace(/CV/g,'');
case "Resume":
thisLink.replace(/Resume/g,'');
case "down":
thisLink.replace(/down/g,'');
case "Mail":
thisLink.replace(/Mail/g,'');
case "Dribbble":
thisLink.replace(/Dribbble/g,'');
case "GooglePlus":
thisLink.replace(/GooglePlus/g,'');
case "Facebook":
thisLink.replace(/Facebook/g,'');
case "Twitter":
thisLink.replace(/Twitter/g,'');
default:
thisLink.replace(thisLink.html(),thisLink.html());
}
}
});