I have a for loop that generates html. I'd for this method to generate the elements randomly. Right now they are cardinally generated i.e. d1, d2, ... di. I want them to follow a random sequence i.e. d1, di, di-3, .. di-k.
//create description inputs
html += '<table id=\"tablestyle\">'
for (let i = numberOfInputs; i < dlArray.length+numberOfInputs; i++){
html += '<td id="row';
id = (1+i-numberOfInputs);
html += id;
html +='">\n';
html += '\t\t<div id=\"t';
html += id;
html +='" class=\"ltarget\"></div>\n \t</td >\n \t<td id=\"d2\">'
html +=dlArray[i-numberOfInputs];
html +='</td >\n </tr>\n';
}
html += '</table>';
Any help with this would be greatly appreciated. Thanks.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment