【发布时间】: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 存在于文档中,但是它们没有被包装在 <div id="working-with-us"> 中
此代码的codepen 工作正常。
WordPress 会不会让事情变得复杂?
帮助表示赞赏。
【问题讨论】:
-
尝试在
jQuery(document).ready(function() { });中使用上述代码 -
谢谢,@MominIqbal,如果你喜欢,请添加答案