Skip to content Skip to sidebar Skip to footer

Inline Onclick Event Returns A "uncaught Syntaxerror: Unexpected Token ( " Error

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('\'

Solution 1:

You have to Invoke the function, if you are including the function directly in onclick attribute, you have to use immediate function like this, though below you have to define what editor is first

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

Solution 2:

Try this:

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

Post a Comment for "Inline Onclick Event Returns A "uncaught Syntaxerror: Unexpected Token ( " Error"