当我添加一些<select>
前。SELECT_country, SELECT_country1, SELECT_country2
我想按照出现的顺序从最新的到最旧的将它们删除。但是,它正在从最早的一种迁移到最新的一种。我以为SELECT_country
是父级,我将删除其子级,但父级先离开。
我该如何更改?
var j = 0;
function add_country() {
j++;
var select = document.getElementById("SELECT_country");
var clone = select.cloneNode(true);
clone.setAttribute("id", "SELECT_country" + j);
clone.setAttribute("name", "country" + j);
document.getElementById("DIV_country").appendChild(clone);
}
function remove_country() {
var select = document.getElementById('SELECT_country');
select.parentNode.removeChild(select);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句