JSFiddle - React, Tailwind, and code Playground

by crysfel

HTML

<select id="selectElementId"></select>

JavaScript

/**
 * @author Crysfel Villa
 * @website http://quizzpot.com
 *
 **/
var min = 1,
    max = 10,
    select = document.getElementById('selectElementId'),
    frag = document.createDocumentFragment();

for (var i = min; i<=max; i++){
    var opt = document.createElement('option');
    opt.value = i;
    opt.innerHTML = 'Option: '+i;
    frag.appendChild(opt);
}

//insert to the DOM
select.appendChild(frag);