【问题标题】:jQuery wrapAll not working with WordPressjQuery wrapAll 不适用于 WordPress
【发布时间】:2021-02-11 23:55:27
【问题描述】:

来自this answer,我想出了以下 JS 来添加到 WordPress 网站:

jQuery('#working-with-us-top, #working-with-us-bottom').wrapAll('<div id="working-with-us" />');

这是在一个 JS 文件中,可以使用 jQuery 作为依赖项加载该文件,并且 #working-with-us-top #working-with-us-bottom 存在于文档中,但是它们没有被包装在 &lt;div id="working-with-us"&gt;

此代码的codepen 工作正常。

WordPress 会不会让事情变得复杂?

帮助表示赞赏。

【问题讨论】:

  • 尝试在jQuery(document).ready(function() { });中使用上述代码
  • 谢谢,@MominIqbal,如果你喜欢,请添加答案

标签: jquery wordpress


【解决方案1】:

尝试在jQuery(document).ready(function() { });中使用上述代码

Reference

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多