小编web*_*ike的帖子

如何在 amp-script 中使用 jQuery?

AMP 文档提到将 jQuery 与 amp-script 组件一起使用:https : //amp.dev/documentation/guides-and-tutorials/develop/custom-javascript/

但是,我没有看到任何示例,也没有说明如何执行此操作。

我已经尝试在下面的示例 AMP 页面中包含 jQuery(分别为 3.4.1 和 2.2.4),并运行这个简单的 jQuery 脚本:

$('button').click(function() {
    $('body').append('hello world');
})
Run Code Online (Sandbox Code Playgroud)

AMP 页面示例:

https://apps.yourstorewizards.com/sandbox/amp/amp-script/jquery3.html https://apps.yourstorewizards.com/sandbox/amp/amp-script/jquery2.html

两者都不按预期工作。两者都会产生 javascript 错误。在 AMP 中可以使用哪些 jQuery 函数是否有限制?

任何帮助,将不胜感激。谢谢。

jquery amp-html

6
推荐指数
1
解决办法
7842
查看次数

标签 统计

amp-html ×1

jquery ×1