Hi Guys,
Ive got a menu that dynamically creates <select> drop down boxes for categories and sub categories etc.
When a dropdown is changed I want to remove all susequent siblings (all <select>'s) from the current div.
Heres the code i have....
"dd" is the last used select box, using onchange="remov eSiblingsAfter( this)"
So basically you will select an option from one DD box and all the ones after will be removed and then replaced by a new one.
I just cant seem to get it removing all the sibling nodes after the current one correctly..
Can anyone help?
thanks
Andy
Ive got a menu that dynamically creates <select> drop down boxes for categories and sub categories etc.
When a dropdown is changed I want to remove all susequent siblings (all <select>'s) from the current div.
Heres the code i have....
Code:
function removeSiblingsAfterl(dd){
//remove siblings after dd
divCatsel = document.getElementById('catselect');
siblingNode = dd.nextSibling;
while (siblingNode.nextSibling) {
divCatsel.removeChild(siblingNode);
siblingNode = siblingNode.nextSibling;
}
//add new select box in place....
}
So basically you will select an option from one DD box and all the ones after will be removed and then replaced by a new one.
I just cant seem to get it removing all the sibling nodes after the current one correctly..
Can anyone help?
thanks
Andy
Comment