我制作了一个chrome扩展程序,目前在地图上的搜索字段中会填充一个城市。当点击弹出窗口上的按钮时,我试图让它填写,而不是在页面加载时填充地图上的文本字段,这就是现在正在发生的事情。
info.js是内容脚本
popup.html
<html>
<body>
<center>
<button id="clickme">Fill in!</button>
</center>
<script type="text/javascript" src="popup.js"></script>
<script type="text/javascript" src="info.js"></script>
</body>
</html>
popup.js
document.getElementById('clickme').addEventListener('click', hello);
info.js
$("#body").val("San Francisco");
提前谢谢!