gpt4 book ai didi

html - CKEDITOR 剥离按钮内的 anchor 标签

转载 作者:行者123 更新时间:2023-12-04 00:38:16 24 4
gpt4 key购买 nike

我有一段这样的html代码

<button class="login_btn"><a href="#">Login</a></button>

但是当我应用 CKEDITOR 内联编辑器时,它变成了

<button class="login_btn">Login</button>

我试过用

config.allowedContent = true;

config.extraAllowedContent = 'button(*){*};a(*){*};';

但问题依然存在。我不想剥夺任何东西。

最佳答案

CKEditor 正在剥离 <a>来自 <button>因为 <button> 不能包含 <a>元素。使用 HTML validator 检查您的 HTML .

来自html5 button spec :

there must be no interactive content descendant.

还有 interactive content页面列出 anchor 标记 <a>作为第一个例子。

关于html - CKEDITOR 剥离按钮内的 anchor 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22342844/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com