我有一个按钮在这个之外工作,但我真的想用一个普通的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>
……我做错了什么?
您必须调用该函数,如果您直接在onclick属性中包含该函数,则必须使用像这样的直接函数,尽管下面您必须首先定义哪个编辑器
<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>