javascript - 如何在自定义 amp 脚本中使用 jquery?
问题描述
我尝试在下面的示例 AMP 页面中包含 jQuery
<script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script>
<amp-script data-ampdevmode src="http://localhost/wptest/wp-content/themes/twentytwentyone/hello-world.js" width="300" height="100">
<p>A single line of text</p>
<button class="abc">text</button>
</amp-script>
并在 hello-world.js 中运行这个简单的 jQuery 脚本:
$('button').click(function() {
alert("hello");
$('body').append('hello world');
})
解决方案
推荐阅读
- python - 如何从 setup.py 文件中读取需求
- opengl - 将计算着色器输出渲染到屏幕
- sql-server - 在表 SQL 中组合 string_split 列结果
- algorithm - 编写一个高效的算法,将树划分为最多具有 V/2 个顶点的连通分量
- windows - 下载 gitlab repo 的 zip 时,Unicode 文件名未保留在 Windows 上
- jestjs - 为所有测试配置一次笑话超时
- node.js - 云功能和 Firebase 的客户端 CORS 错误
- java - Jmeter 1 线程组和多个 HttpRequest
- sql - 选择所有具有时间格式的列
- pandas - groupby([]).sum() 上的意外结果