pragyanbo
pragyanbo10mo ago

How to retrieve a variable from an HTML component based on onclick = "function(this)" functionality?

I've written custom HTML to create a list using the HTML component in the Windmill app. I want to retrieve the <li> tag value that was clicked on the component. Is there a way to do this?
5 Replies
rubenf
rubenf10mo ago
I don't think so, you will probably want to use custom components instead (which does require EE)
pragyanbo
pragyanbo10mo ago
I see. Thank you!
rubenf
rubenf10mo ago
there ar eprobably ways to communicate data between frame and the parent but we haven't explored it enough to provide you with guidance
Tiago Serafim
Tiago Serafim10mo ago
I tried sometime ago <button onclick="window.parent.postMessage('hi');">hi</button> and in a background runnable
window.addEventListener(
"message",
(event) => {
if (event.data !== "hi") return;
alert('hi')
},
false,
);
window.addEventListener(
"message",
(event) => {
if (event.data !== "hi") return;
alert('hi')
},
false,
);
it did post the message
rubenf
rubenf10mo ago
^ @Faton we should document thise