hmm: Dynamische Auswahlbox in Tabelle reinbauen

Beitrag lesen

joa

function addTableRow() {
    var tempTr = $('<tr><td><input type="number" id="mid_' + i + '" class="form-control" disabled/></td><td><input type="text" id="name_' + i + '" class="form-control"/></td><td><select id="skill_' + i + '" class="form-control" /><td><input type="text" id="subskill_' + i + '" class="form-control" /></td><td><input type="number" id="nivau_' + i + '" min="0" max="5" class="form-control" /></td><td><span class="glyphicon glyphicon-minus addBtnRemove" id="addBtnRemove"></span></td></tr>');
    $("#tableAddRow").append(tempTr);
    var option = new Option("Test");
    document.getElementById("skill_" + i) = option;
    $('.addBtnRemove').click(function () {
        removeIndex[removeIndex.length] = i;
        $(this).closest('tr').remove();  
    });
    i++;
}

wenn iuch die richtige syntax für

var option = new Option("Test"); document.getElementById("skill_" + i) = option;

finde gehts. aber ist das sinnvoll das so zu machen? der code wird immer beschissener