JSFiddle - React, Tailwind, and code Playground
by nipheon
HTML
<menu data-="1:stuff.html, 1.1:second.html; 2:other.html" />
<div id="menu">
</div>
<div id="output">
</div>
JavaScript
result = [[[]]];
$(document).ready(function () {
var fullString = ($('menu').attr('data-'));
result = fullString.split(';');
for (i=0; i < result.length; i++) {
result[i] = result[i].split(',');
for (j = 0; j < result[i].length; j++) {
result[i][j] = result[i][j].split(':'); }
}
/* build menu */
$('#menu').append('<ul>');
$('menu').append('</ul>');
/* test */
$('#output').text($('menu').html());
});