我正在开发一个小型Web应用程序,它可以更改选择下拉列表的内容.
我想知道appendChild()和add()是否在JavaScript中的select DOM对象上完成相同的任务?
var someSelect = document.getElementById('select-list');
var newOption = document.createElement('option');
someSelect.appendChild(newOption);
// The above is the same as the following?
someSelect.add(newOption);