html select動態賦值

luxika發表於2011-11-21
var positionIds = $("savePerformanceWorkflowExamineResearch_performanceWorkflowExamine_positionId");
positionIds.options.length = 1;
positionIds.options[0].selected = "selected";
DWREngine.setAsync(false);
performancePositionService.getPositionsByUserId(employeeId, function(positions) {
if (positions != undefined && positions != null && positions.length > 0) {
for (var i = 0; i < positions.length; i++) {
positionIds.options[positionIds.options.length] = new Option(positions[i].positionName, positions[i].id);
}
}
});

相關文章