IE : Option, attribut selected perdu ?
Lorsque je mets la valeur selected à vrai pour une option d'un select, cette valeur se perd lorsque je rajoute le noeud select dynamiquement (inclu dans un noeud parent par exemple).
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
[...]
for (var x = 0; x < selectObj.options[x].length; x++) {
if (selectObj.options[x].hasAttribute("selected")) {
selectObj.options[x].setAttribute("selected","false");
}
}
selectObj.options[statut].setAttribute("selected","true");
[...] |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
[...]
for (var x = 0; x < obj_id_array.length; x++) {
var DIV = document.getElementById("DIV_" + obj_id_array[x]);
/*
DIV_array.push(DIV.cloneNode(true));
DIV_parentNode = DIV.parentNode;
DIV_parentNode.removeChild(DIV);
*/
DIV_parentNode = DIV.parentNode;
DIV_parentNode.removeChild(DIV);
DIV_array.push(DIV);
}
[...] |