Move
I'm trying to create a button that will move the currently selected OPTION in a SELECT MULTIPLE list to the top of that list. I currently have OptionTransfer.js implemented, which
Solution 1:
Use DOM manipulation methods. Given:
varselect = document.getElementById ("..."); // select elementvar option = select.options[select.selectedIndex] // option element
- Remove selected option from select:
select.removeChild (option)
- Reinsert it as first child:
select.insertChild (option, select.firstChild)
Or use select.add() and select.remove()
http://www.w3schools.com/jsref/dom_obj_select.asp
Post a Comment for "Move