I have two little changes I want to make.
var selectedOption = jQuery("#modulesDrop option:selected");
selectedOption.appendTo($("#moduleselect"));
$('option.red').appendTo($("#moduleselect"));
-
How can I get the
selectedOptionto be removed from the#moduleDropand#moduleselect. -
I have a class
$('option.red')and I only want it to append to#moduleselectif the contents in#moduleselectis empty.
#moduleSelect is a multiple select box while ‘#modulesDrop’ is a drop down menu.
Below is a jsfiddle
Simply follow the steps to use fiddle:
- You will see a drop down menu, select a course from the drop down menu.
- You will see the details of the selected course from the drop down menu are displayed. Click on the “Remove Module” submit button.
- Confirm the confirmation box. Nope happens at mo but I want the selected module in the drop down menu to be remove from the drop down menu and from the select box
“How can I get the selectedOption to be removed from the #moduleDrop and #moduleselect.“
“I have a class $(‘option.red’) and I only want it to append to #moduleselect if the contents in #moduleselect is empty.“