Trying to link javascript to HTML Widget

Hi,

I tried to link JavaScript to my HTML Widget. Please, any can help me?

ley_de_Ohm.zip (26.7 KB)

Thanks in advance!

When creating an HTML widget in Hype, it's important to understand that these widgets are essentially iframes. The naming can be confusing for many people. Essentially, you're embedding an iframe that expects a complete file, which in turn references another JavaScript file. This approach can be complex and challenging to manage.

To simplify your setup, consider embedding arbitrary HTML directly into a rectangle (a div) within Hype. This allows you to leverage Hype's built-in functions for assigning actions like click event handlers, making the entire process more straightforward.

However, it's difficult to provide specific advice without seeing your actual file with all necessary resources. If you can share the file you're referencing inside the iframe, it would be easier to give more precise guidance.

1 Like

As @MaxZieb says.
You would be better of putting the html in a Rectangle.

It look like to me you are trying to target the Hype function.

You can actually put the code directly in the Hype Head file or the innerHTML

If you do want to keep it in the Hype function then you would need to target it correctly
Any html inside a elements innerHTML is treated like an if
There are Manny threads to show this.
Look at this one

and this which shows how the onclick part works.


Saying all of that, I personally would not use innerHTML to do all of the design ofthis. I would use hype elements. which can easily link to the hype functions and code to target any innerHTML textfield you have.

1 Like