我有三个不能编辑其HTML的标记:
<a onclick="switchEditors.switchto(this);" class="wp-switch-editor switch-html" id="content-html">Text</a>
<a rel="popover" class="wp-switch-editor switch-html content-bootstrap" id="content-html" onclick="switchEditors.switchto(this);">Syntax</a>
<a onclick="" class="wp-switch-editor switch-tmce" id="content-tmce">Visual</a>
它们非常相似,但是我只选择第一个:
<a onclick="switchEditors.switchto(this);" class="wp-switch-editor switch-html" id="content-html">Text</a>
任何想法什么是最好和最稳定的jQuery选择器吗?谢谢。
干杯。
更新:可以更改此ID,但是我已经编辑了WordPress核心(也不推荐)。当前没有提供其他过滤器来执行此操作。在/wp-admin/js/editor.min.js中,它们获取ID的值以处理选项卡切换机制(从符号到文本编辑器,反之亦然)。我添加了第三个链接(语法),使其具有与HTML /文本编辑器相同的功能,但稍后会实例化CodeMirror。
$("a.wp-switch-editor:first")
这应该为您工作,请参阅此以获取更多信息:第一
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句