当我尝试使用 javascript/jquery 将某些文本替换为其他特定文本时出现此错误。
这是错误:
未捕获的类型错误:对象 [object HTMLAnchorElement] 没有方法“html”
以下是网站上的 javascript 行:
$(document).ready({
var navigationLinks = $('.nav a');
for(var i=0; i < navigationLinks.length; i++){
var thisLink = navigationLinks[i];
switch(thisLink.html()){
case "About":
thisLink.html().replace(/About/g,'');
case "Work":
thisLink.html().replace(/Work/g,'');
case "CV":
thisLink.html().replace(/CV/g,'');
case "Resume":
thisLink.html().replace(/Resume/g,'');
case "down":
thisLink.html().replace(/down/g,'');
case "Mail":
thisLink.html().replace(/Mail/g,'');
case "Dribbble":
thisLink.html().replace(/Dribbble/g,'');
case "GooglePlus":
thisLink.html().replace(/GooglePlus/g,'');
case "Facebook":
thisLink.html().replace(/Facebook/g,'');
case "Twitter":
thisLink.html().replace(/Twitter/g,'');
default:
thisLink.html().replace(thisLink.html(),thisLink.html());
}
}
window.onscroll=scrollFunc;
});