Import html

Import html from another html file.

–component.html

<div id="container"> <h1>Content from another html file.</h1> <p>lipsum lipsum lipsum</p> </div>

–index.html

<head>
<link rel="import" href="component.html">
</head>
<body>
<script>
    var link = document.querySelector('link[rel="import"]');
    var content = link.import;
    var el = content.querySelector('#container');
    document.body.appendChild(el);
</script>
</body>

[vc_single_image image=”897″ img_size=”full”]

Leave a Reply

Your email address will not be published. Required fields are marked *