pragyanbo
pragyanbo2y 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
rubenf2y ago
I don't think so, you will probably want to use custom components instead (which does require EE)
pragyanbo
pragyanboOP2y ago
I see. Thank you!
rubenf
rubenf2y 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 Serafim2y 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
rubenf2y ago
^ @Faton we should document thise

Did you find this page helpful?