内联onclick事件返回“未捕获的SyntaxError:意外的令牌(错误) [英] Inline onclick event returns a "Uncaught SyntaxError: Unexpected token ( " error
本文介绍了内联onclick事件返回“未捕获的SyntaxError:意外的令牌(错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个可以在此之外使用的按钮,但是我真的想只使用普通的div复制操作.我可以通过添加以下clickhandler来做到这一点:
I have a button that works outside of this, but I really want to replicate the actions with just a normal div. I can do so by just adding this clickhandler:
editor.insertText("\"≥\"");
进入onclick事件.我想将该代码段添加到内联div中,但从以下div中不断收到"Uncaught SyntaxError: Unexpected token (
"错误:
to an onclick event. I want to add that snippet to an inline div but I keep getting an "Uncaught SyntaxError: Unexpected token (
" error from the below div:
<div style="background-color:red; width:50px; height: 50px;" onclick='function () { editor.insertText(\\≥\\); }'></div>
......我在做什么错了?
......What am I doing wrong?
推荐答案
尝试一下:
<div style="background-color:red; width:50px; height: 50px;" onclick='editor.insertText("\"≥\"");'></div>
这篇关于内联onclick事件返回“未捕获的SyntaxError:意外的令牌(错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文