TypeError:无法读取属性“removeAttribute”的空值 [英] TypeError: Cannot read property "removeAttribute" of null

查看:455
本文介绍了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>  

解决方案

<你是否在Chrome上运行它?它可能与AdBlock相关。尝试将您的浏览器更改为FireFox并查看是否收到相同的错误。

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”的空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆