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'); 

http://api.jquery.com/load/


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -