![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Refactoring my old DualSelectBox [1], I thought it would be much smarter to get rid of the new Option() stuff, and instead just switch childNodes between the two select elements. Something like that: function shiftSelectedOptions(src, dest) { var i, len, opts = []; for(i = 0, len = src.options.length; i < len; i++) { if (src.options[i].selected) { opts.push(src.options[i]); } } for(i = 0, len = opts.length; i < len; i++) { opts[i].selected = false; dest.appendChild(opts[i]); } } Works as expected in all reasonable browsers, alas IE6 (and perhaps 7, too) has issues. The childNodes get removed from the source element, and get appended to the destination element - at least that's what this abysmal DOM Explorer tells me. But they stay invisible - as if some sort of "refresh" is missing. |
|
BTW: The childNodes of the select elements get cleaned, i.e. all nodes that are not of the "OPTION" type get removed, including plain textnodes. |
![]() |
| Thread Tools | |
| Display Modes | |
| |