Popup.js 不适用于 Chrome 扩展程序
Popup.js not working for Chrome Extension
目前我正在开发 chrome 扩展程序,但是 popup.html 我无法让 popup.js 工作
popup.html
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body style="width: 15rem; height: 15rem">
<div class="container-fluid" style="padding: 10px">
<input id="url" />
<button type="button" id="newDetails">Submit</button>
</div>
<script src="./popup.js"></script>
</body>
</html>
popup.js
console.log("Hello")
let btn = document.getElementById("newDetails");
btn.onclick = function () {
console.log("Clicked!");
};
我已经看了很多 questions/answers(例如 ,this,),但 none 已经能够解决我的问题。
提前致谢!
已解决!吴浩在原评论中回答post.
需要检查弹出窗口的控制台与浏览器控制台。您可以通过右键单击扩展并检查它来做到这一点。
目前我正在开发 chrome 扩展程序,但是 popup.html 我无法让 popup.js 工作
popup.html
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body style="width: 15rem; height: 15rem">
<div class="container-fluid" style="padding: 10px">
<input id="url" />
<button type="button" id="newDetails">Submit</button>
</div>
<script src="./popup.js"></script>
</body>
</html>
popup.js
console.log("Hello")
let btn = document.getElementById("newDetails");
btn.onclick = function () {
console.log("Clicked!");
};
我已经看了很多 questions/answers(例如
提前致谢!
已解决!吴浩在原评论中回答post.
需要检查弹出窗口的控制台与浏览器控制台。您可以通过右键单击扩展并检查它来做到这一点。