I had someone who made this script (credit Chyno Deluxe) that generates a list of menus that we write on the box, the question is, do I need to create a sequence of numbers that is constantly added to it
here is an example needed
<li id='item1'></li> <li id='item2'></li> <li id='item3'></li> <li id='item4'></li>
the number generated next to the '#' element, 1,2,3,4,5,6
I had this to generate a number, but it was a fixed number, here
$.map($(Array(8)),function(val, i) { return i; })
this one only does it
1,2,3,4,5,6,7,8
script
(function($) {
"use strict";
var t2h = {
buildHTML: function() {
var i, list, type = this.htmlSelect.options;
if (type[1].selected) {
list = "<select>";
list += "\n";
for (i = 0; i < this.get_items().length; i++) {
list += " <option>";
list += this.get_items()[i];
list += "</option>";
list += "\n";
}
list += "</select>";
you can see the demo below using jquery code which will generate
<select>
<option>menu 1</option>
<option>menu 2</option>
</select>
I need to improve it by adding id = '' + number tag on it, for example
<select>
<option id='item1'>menu 1</option>
<option id='item2'>menu 2</option>
</select>
demo: [link] http://codepen.io/diden/pen/YwwVKO
Hope I can get help with this, thanks guys :)