Reputation: 121
I'm working on this website where users can create their own bundles. Basically they have a list of courses and they can pick 5 and create a bundle.
The approach I'm taking is a dropdown list of all courses that then gets cloned on click.
What I'd like to do is disable any previously selected items on the next cloned list.
Is this possible?
Here's my code: http://jsfiddle.net/Y4fLM/
Thanks a lot!
Upvotes: 0
Views: 1791
Reputation: 577
You can try this one as well
As with your question it seems may be this could be helpful for you.
Upvotes: 1
Reputation: 3657
Is this what you're looking for?
http://jsfiddle.net/VLrpn/
The key code comes right before attaching the new element:
$('.hidden-itemname').each(function(index) {
newElem.children('.hidden-itemname').children('option[value="'+$(this).val()+'"]').remove()
});
Upvotes: 1
Reputation: 55740
I had to work on somewhat similar requirement to your's but , instead of dynamically creating the select's I have 3 of them on the page.
Check this FIDDLE .. It might be of help.
Upvotes: 2