What is the correct format to set the HTML attributes of an element dynamically, for example I want to set several attributes dynamically.
I tried to map an object but it didn’t work. I can only do so if the attribute and value are individual. However, in a component I will need to define it dynamically depending on the properties selected in the component.
I think it could be something like: [{key: "data-attribute", value:"first-value"}, ..] this was the structure that WeWeb used fro Supabase metadata as well, so I think this might be the convention across the app.
I’m trying to add an allow=”camera; microphone” html attribute to an iframe but it doesn’t work. Any reason why It is not added to the iframe element?
[{name: “allow”, value:“camera; microphone”}]
_______
I found the reason for not working as expected. Weweb automatically creates a parent div element wrapping the iframe element, but all attributes set to the iframe element on the Weweb editor are indeed set to the parent div, not the iframe itself.