html Script Error

Hello

I'm trying to send a function from a html onclick event but dom can't find it.
I have this same code on another platform and if you accept it.


Hi @Laura Ramírez,

Your code looks good to me, can you attach a screenshot of the problem you are encountering?

For e.g. if you right click -> 'Inspect' and then once the Developer tools opens, click on your image what do you get in the 'Console' tab?

Regards,

AJ

thanks

my personal environment is down in this moment, but the error in the console is: 

“Uncaught ReferenceError: function is not defined at HTMLUnknownElement.onclick”

mvp_badge
MVP

Hi Laura,

First of all you should select when you ask a question the type of application you build, traditional web app, reactive web app or mobile app. Depending on the type of all you build a solution may be different.

Second why are you adding all this html to a local variable? Hoe do you inject this as html? 

Would you not be able to make your app truly lowcode without the need for custom html and injecting also jQuery just to declare a JavaScript function?

Anyhow, I believe onClick is misspelled, it should all be lowercase. The way you declare the script tag for the JavaScript function does not ensure it is available at the time the onClick event is fired.

May you could try explain what you try to achieve with your application, probably you do not need any of this JavaScript and custom html.

Regards,

Daniel

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.