0

I have this HTML inside some frame:

<body class="Toolbar" onload="InitDocument()" leftmargin="10" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0">
    <div id="divRefresh2" name="divRefresh" class="cssRefresh" style="display:none;"> 
        <span>some text</span>
    </div> 
</body> 

at some point I need to display div with id = divRefresh2.

When I need display the element above I fire this js function:

function OnMapLoading()
{
    var frmParent = parent.frames["tbFrame"];
    var objDivRefresh = frmParent.document.getElementById("divRefresh2");
    if(objDivRefresh != null)
    {
        objDivRefresh.style.display='block';
    }
}

As you can see the function, OnMapLoading get element by div and set display to block.

In debugger I put breake point after this row:

objDivRefresh.style.display='block';

and in the debugger I see that display property changes to block, but in browser I dont see any changes the element is not displyed.

Any idea how can I fix the problem?

shmnff
  • 647
  • 2
  • 15
  • 31
Michael
  • 13,950
  • 57
  • 145
  • 288
  • try `!important` : `objDivRefresh.style.display='block !important'` – לבני מלכה Jun 03 '18 at 11:30
  • 1
    Are any of that element's parents hidden? Please provide a [mcve] that reproduces problem – charlietfl Jun 03 '18 at 11:31
  • There is no `!important` when setting styles with javascript? If you can see the display property changing in the console, the posted code works, you're targeting the correct element, and the style is set, so something else is the problem – adeneo Jun 03 '18 at 11:45
  • @adeneo Of course you can set `!importnat` in Js code:https://stackoverflow.com/questions/462537/overriding-important-style – לבני מלכה Jun 03 '18 at 11:47
  • That answer is actually telling you that you can't, it inserts a style tag instead to solve that exact issue – adeneo Jun 03 '18 at 11:49
  • why are you using html attributes for setting styles? – shmnff Jun 03 '18 at 13:06

0 Answers0