javascript - How to define div specific script tag? -
i have multiple div's inside html, have defined multiple tabs inside html. using script tag inside 1 of tab display data. leaves specific div , goes out of div , permanently displayed after tabs.
<div class="tabs-pane active-pane" id="actors" role="tabpanel" aria-hidden="false" style="text-align:center;"> <div class="aui-page-panel-inner"> <div class="aui-page-panel-nav"> <script> display_data_new(); myfunction(); </script> </div> </div> </div>
i'm going assume data have in functions formatted html - there numerous tutorials on web this.
try this:
(function() { var loaddata = function(){ var contentdiv = document.getelementbyid('content'); contentdiv.appendchild(display_data_new()) ; contentdiv.appendchild(myfunction()); } window.onload = loaddata(); })(); this going execute when window has finished loading. function grabs content dom element , append code display_data_new() , myfunction() functions it.
i suggest reading dom:
https://developer.mozilla.org/en-us/docs/web/api/document_object_model/introduction
it's fundamental understand in order use javascript manipulate html.
Comments
Post a Comment