mercredi 1 juillet 2015

How to display multiples of imported html copies?

I would like to make attempt for multiple html imports through a javascript/ jQuery. However, I don't find there are any examples on the internet. Possibly because the html import technology is emerging.

In fact, I made an attempt. However, this does not have to be the guidelines.

<link rel="import" class="note-import" href="blah.html" />
<div id="notes">
<!-- Put it in here -->
</div>  
    <script>
        var links = document.getElementsByClassName('note-import');
        for (var i = 0; i < links.length; i++) { 
            var cont = document.head.importNode(links, true);
            document.getElementById('notes').appendChild(cont);
        }
    </script>

The code means I want to display the html(s) (whom are divs with styles and so on) into the div with id notes.

Aucun commentaire:

Enregistrer un commentaire