custom javascript code not working from html component

Hi everyone,
I’m trying to create a very, very simple website for an experiment that I want to conduct. I’m going to insert a “Danmaku” feature to a video, and I created this feature using some JS codes. Basically, you just need to type whatever you want to say in the input and click “Submit” and your words will appear on the video. The code works fine on browsers, but when I tried to copy and paste them to wix html component/html iframe (so that I can publish the website to my participants) the JS part didn’t work — no word was appearing on the video. Cause I’m a newbie to wix, I’d love to get help on this. Does anyone have advice?
Here is the complete code:

.ctxt{ background:#fff; width:1000px; height:400px; overflow:hidden; margin:0 auto; } .ctxt p{ position:absolute; left:1000px; margin:0; padding:0; }

Submit

Thanks very much and I appreciate your time!!!

Hi,

I played with your component and you right its not working inside Wix embed HTML component.

  1. Its not exactly related to Wix Code but to HTML components so will recommend you to open ticket in the Wix support for this. [Help Center | Wix.com]
  2. Other idea that I can suggest to achieve similar result in much easier way (Wix editor components):
  • Create Strip with background video or You tube video components
  • Add text component on top of it in your favor location with animation “FlyIn for the right” and mark as hide on load with ID: “MyText”
  • Add input Field with ID: “MyInputField”
  • Add Button with ID: “MyButton”
  • Implement the below code in the page code area.

$w.onReady( function () {
$w(“#MyButton”).onClick(() => {
$w(“#MyText”).text = $w(“#MyInputField”).value;
$w(“#MyText”).show().then(() => {$w(“#MyText”).hide(); })
});
});

You can continue play with the new animation options of the text. Article: IFrame - Velo API Reference - Wix.com

Enjoy, Erez