|
|
function removeEmptyOptions()
{
var optionBoxes = document.getElementsByTagName('select');
var numOptionBoxes = optionBoxes.length;
var i = 0;
// Check each item in the array. If it is empty, remove it. Otherwise, move to the next item.
// If the item is removed, there is no need to increment the array pointer, because
// the array will resize itself, bringing a new element into the slot that was just checked.
while(i < numOptionBoxes && i < optionBoxes.length)
{
if(optionBoxes[i].selectedIndex > -1)
{
if(optionBoxes[i].options[optionBoxes[i].selectedIndex].text == "")
optionBoxes[i].parentNode.removeChild(optionBoxes[i]);
else
{
i++;
}
}
else
{
i++;
}
}
}
3M Dust Remover / Compressed Air for Dusting Equipment, Computers, etc |