CSS style not applying on dynamic injected html elements

General issues related to the use of Metro 4
Post Reply
DarkOrico
Posts: 1
Joined: Fri Jul 26, 2019 1:26 am
Status: Offline

CSS style not applying on dynamic injected html elements

Post by DarkOrico » Fri Jul 26, 2019 1:34 am

Hello,

At first I would like to thank you for all the work you have done.

It's been a few days now that I'm trying to use MetroUi and I'm really happy with it.

However, I noticed that CSS style not applying on dynamic injected html elements with javascrip

Exemple :

[codepen]<body onload="init()" class="bg-dark fg-white h-vh-100 m4-cloak">
<div class="container-fluid start-screen h-100">
<h1 class="start-screen-title">Home Sweet Myrrha</h1>
<div id="arrayTile" class="tiles-area clear">
</div>
</body>[/codepen]

and myFunction :
[codepen]function init()
{
var stringHtmlTile = decodeEntities("<%=dataTile%>");
document.getElementById('arrayTile').innerHTML = stringHtmlTile;
//console.log(stringHtmlTile);
}[/codepen]

The code that HTML I retrieve comes my variable: stringHtmlTile
does not show me the correct CSS style.

While if I copy the contents of the variable into hard between tags

[codepen]<div id = "arrayTile" class = "tiles-area clear">
</div>[/codepen]

The layout is nickel ...

Can you help me ?

Thanks You,

DarkOrico

User avatar
olton
Site Admin
Posts: 233
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Tue Jul 30, 2019 8:29 pm

Please create your example on codepen.io or sandbox.org.ua

Post Reply