html - set innerHTML of div tag under li tag in javascript -
i have below html , want add innerhtml of div tag.
<li id="liflashdetectionmessage" class="width730 height30 divfloatleft marginleft15"> <div id="divflashdetectionmessage" class="divfloatleft marginleft5 width730"> </div> </li>
i have written below giving javascript error.
document.getelementbyid("divflashdetectionmessage").innerhtml = "oops, flash player not installed on browser.";
can how it?
without having seen full code, bet code run before dom ready.
since browser parse code top bottom , execute javascript immediately, if <script>
tag put before actual <div>
element try manipulate, in source, won't find match when run document.getelementbyid()
because @ time piece of code execute, browser still doesn't know tag declare further down page.
try moving script-element bottom of page, before closing </body>
tag.
if can't/don't want move javascript, have listen dom-ready event browser fires dom ready, , execute code when know dom ready.
Comments
Post a Comment