1 year ago

#383178

test-img

WarrenG

How can I make an iframe available to a form target attribute inside shadowRoot?

I am having a situation where I have to submit a form to populate an iframe.

<form action="" target="iframe_name" method="Post">
</form>
<iframe id="iframe_id" name="iframe_name"></iframe>

The problem is that everything is inside shadowRoot, so the target attribute from the form failes to find my iframe name.

There is the workaround, that would imply not using shadowRoot but I would rather use my existing structure if there is any way to make the iframe available for the target attribute to be found.

I also tried to search for a way to dynamically set the attributes for the form directly to the iframe, but from what I could find, the target attribute accepts only names, not DOM elements.

Thank you

javascript

forms

iframe

web-component

shadow-dom

0 Answers

Your Answer

Accepted video resources