JSFiddle - React, Tailwind, and code Playground

by jacob414

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.2.2/underscore-min.js"></script>
<script id='t-li' type='text/html'>
    <% _.each(table_heads, function(head, index) { %>
    <li><%= head %></li>
    <% }); %>
</script>

<script id='t-td' type='text/html'>
    <% _.each(table_heads, function(head, index) { %>
     <td><%= head %></td>
    <% }); %>
    </tr></table>
</script>

        <h2>LI's</h2>
<ul id="lis">
</ul>
        
        <h2>TABLE</h2>
        <table>
            <tr id="rows">

JavaScript

var table_heads = ['a', 'b'];

$('#lis').append(
    _.template($('#t-li').html(),
               {table_heads: table_heads}));

$('#rows').append(
    _.template($('#t-td').html(),
               {table_heads: table_heads}));