Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
create comboboxes programmatically at runtime?
posted

Is it possible to built multiple comboboxes at runtime programatically? I'm doing:
  var root = document.getElementById('root');
        var selectLength = document.getElementsByTagName('select').length;
        var selectlist = document.createElement('select');
        selectlist.id = "select" + selectLength;
        selectlist.onclick = 'alert();';
        
        var ops = new Array("first", "second", "thrid", "fourth", "fifth");
        for (var i = 0; i < ops.length; i++) {
            var o = document.createElement("option");
            var t = document.createTextNode(ops[i]);
            o.setAttribute("value", ops[i]);
            o.appendChild(t);
            selectlist.appendChild(o);
        }
        root.appendChild(selectlist);

And need the ability to add multiple comboboxes.  I may need to create 10 or more boxes based upon the selected value of the prior selected value,  Can this be done using the igCombo?

Thanks

Parents
No Data
Reply
  • 16310
    Verified Answer
    Offline posted

    Hello William,

    Yes it is possible. I prepared a sample demonstrating how this could be done. The user is prompted to select a number in an igCombo control and if he selects N then number of N new combos will be initialized.

    The selectionChanged event of the initial combo is handled where N number of <input> elements are created via Jquery and a new combo is initialized in every new <input> element. Please refer to the sample and let me know if you need any further assistance.

    igCombos.zip
Children