JSFiddle - React, Tailwind, and code Playground
by baximilian
HTML
<title>VBtakst</title>
<body>
<output id="crumMenuOutput"></output>
<br /><br />
<button type="button" id="test">Ny task</button>
<button type="button" id="test1">show tasks</button>
JavaScript
$(document).ready(function(){
function showArray(){
if(menuArray.lenght !== 0){
$.each(menuArray, function(i, val) {
if(i == menuArray.length - 1) var spacer = ""; else var spacer = " > ";
$('#crumMenuOutput').html(val + spacer);
});
};
};
var menuArray = new Array;
menuArray.push("test1"); // add test data to array
showArray();
$("#test").click(function() {
menuArray.push("test2"); // fail to add data on button click
showArray();
});
});