本文介绍了TypeError:无法读取属性“removeAttribute”的空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在点击按钮时立即提醒你好。我在浏览器中得到了上面的错误,并且在下面的html中看到,我将脚本链接放在按钮标签下方,所以我不知道是什么原因导致了错误。任何帮助表示赞赏。
receiver.js
$(#passform)。click(function(){alert(hello); console.log(hello);});});
index.html
<!DOCTYPE html> < HTML> < HEAD> < link href =public / stylesheets / style.css =stylesheets/> < /头> <身体GT; < button type =submitid =passform>< / button> < script type =scripi / javascriptsrc =C:/users/owner/desktop/steelVault/public/javascripts/receiver.js>< / script> < script type =scripi / javascriptsrc =C:/users/owner/desktop/steelVault/public/javascripts/jquery/jquery-2.2.4.min.js>< / script> < /体> < / html>
解决方案
I'm trying to alert "hello" as soon as a button is clicked. I get the error above on my browser, and as seen in the html below, I put the script link below the button tag so I don't know what causes the error. Any help is appreciated.
receiver.js
$(function(){
$("#passform").click(function(){
alert("hello");
console.log("hello");
});
});
index.html
<!DOCTYPE html>
<html>
<head>
<link href="public/stylesheets/style.css" rel="stylesheets" />
</head>
<body>
<button type="submit" id="passform"></button>
<script type="scripi/javascript" src="C:/users/owner/desktop/steelVault/public/javascripts/receiver.js"></script>
<script type="scripi/javascript" src="C:/users/owner/desktop/steelVault/public/javascripts/jquery/jquery-2.2.4.min.js"></script>
</body>
</html>
解决方案
Are you running this on chrome? It could be related to AdBlock. Try changing your browser to FireFox and see if you're getting the same error.
这篇关于TypeError:无法读取属性“removeAttribute”的空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!