전 초급자입니다. "p"태그에서 텍스트를 가져 와서 다른 "p"태그에 넣으려고합니다. 그래서 내 확장 프로그램을 클릭하면 두 개의 텍스트가 표시됩니다. 표시됩니다. 내가 뭘 잘못하고있어? 앞으로 어떻게 비슷한 실수를 피할 수 있을까요?크롬 확장 기능 변경 popup.html 텍스트
popup.html :
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" scr= "popup.js"></script>
</head>
<body>
<p id="firstText">this is the text to be repeated</p>
<p id= "secondText"></p>
</body>
</html>
popup.js :
document.addEventListener('DOMContentLoaded', function() {
var test= document.getElementById("firstText").innerHTML;
document.getElementById("secondText").innerHTML=test;
});
의 manifest.json :
{
"manifest_version": 2,
"name": "test",
"description": "useless",
"version": "1.0",
"background": {
"scripts": [ "popup.js"],
"persistent": false
},
"content_scripts": [
{
"matches": ["http://*/*"],
"js": ["popup.js"]
}
],
"permissions": [
"activeTab","tabs", "http://*/*"
],
"browser_action": {
"default_popup": "popup.html"
}
}
정확한 복사/붙여 넣기의 경우 ''에 오타가 있습니다. 'scr' 대신'src'를 읽어야합니다. –
@ChrisP 너무 당황 스럽네. 도와 줘서 고마워! – Apastrix