html - Extension Comment
问题描述
I'm creating an extension for google chrome that when the user clicks the "Copy!" button, execute this function on the web page
解决方案
onclick="execute()"
这不会运行,因为您不能JavaScript
在 html 文件中使用内联来进行 chrome 扩展。
因此尝试click
使用 JavaScript 在复制按钮上添加事件侦听器,如下所示:
document.addEventListener('DOMContentLoaded', function () {
document.querySelector('input').addEventListener('click', execute);
});
推荐阅读
- html - 为什么我在材料-ui-v3.2.0“图像头像”示例中看不到图像
- python - 按列表中的元组顺序将多个元组列表组合成新的元组列表(python3)
- python - 导入包适用于 jupyter notebook 但不适用于 iPython 和 Anaconda cmd
- ios - Xcode 10 更新:基于弃用的编译器错误
- python - Django的json问题:'tuple'对象没有属性'_meta'
- python - Python - Pandas,重新采样数据集以具有平衡的类
- mysql - mysql在同一张表上写选择子查询,结果集上有条件
- bootstrap-4 - 在所有其他屏幕上隐藏表格列而不是大屏幕
- odoo - 隐藏按钮编辑,在 odoo xml 上创建
- activerecord - Papertrail 轨道通过关联创建但不删除