javascript - How to display multiples of imported html copies? -
i make attempt multiple html imports through javascript/ jquery. however, don't find there examples on internet. possibly because html import technology emerging.
in fact, made attempt. however, not have guidelines.
<link rel="import" class="note-import" href="blah.html" /> <div id="notes"> <!-- put in here --> </div> <script> var links = document.getelementsbyclassname('note-import'); (var = 0; < links.length; i++) { var cont = document.head.importnode(links, true); document.getelementbyid('notes').appendchild(cont); } </script>
the code means want display html(s) (whom divs styles , on) div id notes.
simply use jquery load html specified divs:
<div id="page1"></div> <div id="page2"></div>
and load content them. can trigger function @ time , ever overwrite content:
$('#page1').load('blah.html'); $('#page2').load('blahblah.html');
Comments
Post a Comment