如何在 tinyMCE 中设置目标属性 [英] How to set target attribute in tinyMCE
本文介绍了如何在 tinyMCE 中设置目标属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 tinymce.execCommand("CreateLink", False, theLink)
设置了指向某些文本的链接.问题是我想设置"Target=_blank"
.
I have set a link to some text using tinymce.execCommand("CreateLink", False, theLink)
. The problem is that I want to set "Target=_blank"
.
如何在上述之后设置 Target
属性?
How do I set a Target
attribute after the above?
谢谢.
推荐答案
您需要在 tinymce 编辑器中识别正确的 html 元素.您可以使用此代码替换/设置链接的目标属性
You need to identify the correct html element in your tinymce editor. You can use this code to replace/set the target attribute of your link
$(ed.getBody()).find('a [href="'+theLink+'"]').attr('Target', '_blank');
请注意,您可能已经在编辑器中拥有相同的链接.在这种情况下,所有此类链接的目标属性都变为_blank".
Be aware that you might have the same link in the editor already. In this case all such links' target attributes become '_blank'.
这篇关于如何在 tinyMCE 中设置目标属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文