[英]How can I get an anchor tag with no or empty href in typo3 ckeditor
In TYPO3 8.7, I'm trying to create an anchor tag to open a modal, in a regular text element, like this:在 TYPO3 8.7 中,我试图在常规文本元素中创建一个锚标记来打开模态,如下所示:
<a class="someclass" data-open="myModal">Click me</a>
But Typo3 will automatically add an href attribute linking to the current page.但是 Typo3 会自动添加一个链接到当前页面的 href 属性。 When I click the tag, the modal opens, but the page immediately reloads.当我单击标签时,模式打开,但页面会立即重新加载。
I've tryed adding href="#"
, but that turns into href="/mypage/#"
and href="#mymodal"
becomes href="/mypage/#mymodal"
, both of which trigger a reload.我已经尝试添加href="#"
,但这变成了href="/mypage/#"
和href="#mymodal"
变成了href="/mypage/#mymodal"
,这两者都会触发重新加载。
In my ckeditor setup, I have set allowedContent: true
在我的 ckeditor 设置中,我设置了 allowedContent allowedContent: true
How can I make an <a>
tag without the href being altered?如何在不更改 href 的情况下制作<a>
标签?
If you have a ClickEvent on an a-tag you need to return false
from the javascript to stop further processing.如果在 a-tag 上有 ClickEvent,则需要从 javascript 返回false
以停止进一步处理。 And following the link is the last further processing.并按照链接是最后的进一步处理。
Even if you manage to reduce the href to #
you page may reload or jump to the start.即使您设法将 href 减少到#
您的页面也可能重新加载或跳转到开头。
Maybe you can fool your browser if you use href="javascript:return false"
.如果您使用href="javascript:return false"
也许您可以欺骗您的浏览器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.