Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

why onclick gives "Uncaught SyntaxError: Unexpected end of input"

i try to do that div gonna do smt onclick but it not worky 🙁

            var wrapper = $('#sperma'), container;
            container = $('<div onclick="console.log("zakupiono sperme")"></div>');
            wrapper.append(container);
            container.append('<h1>swierza sperma z chuja duzego</h1>')

output

Uncaught SyntaxError: Unexpected end of input

i want to get

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

zakupiono sperme

help fast

>Solution :

SyntaxError: Unexpected end of input means that the script ended, while the parser expected that there was more. I believe your issue is that you are using " and ' without escaping the necessary characters.

Try this maybe:

container = $('<div onclick="console.log(\'zakupiono sperme\')"></div>');
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading