我有一个按钮在此之外工作,但我真的想用正常div复制动作。只需添加此ClickHandler:

即可这样做
 editor.insertText("\"≥\"");
.

到onclick事件。我想将该片段添加到内联div,但我一直从以下div中获得“Uncaught SyntaxError: Unexpected token (”错误:

<div style="background-color:red; width:50px; height: 50px;" onclick='function () { editor.insertText(\\≥\\); }'></div>
.

......我做错了什么?

有帮助吗?

解决方案

试试:

<div style="background-color:red; width:50px; height: 50px;" onclick='editor.insertText("\"≥\"");'></div>
.

其他提示

您必须调用该函数,如果您在onclick属性中直接包含函数,则必须使用这样的立即函数,但下面您必须定义哪个编辑器首先

<div style="background-color:red; width:50px; height: 50px;" onclick='(function () { editor.insertText("\\≥\\"); }());'></div>
.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top