Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#yourdropdownlistid option[value='thevalueofthetargetoption']").remove();
- $("#yourdropdownlistid option[value='thevalueofthetargetoption']").each(function() {
- $(this).remove();
- });
- <div id='container'>
- <button>add</button>
- <div class='row'>
- <select>
- <option>hi</option>
- <option>hello</option>
- <option>how</option>
- <option>are</option>
- <option>you</option>
- </select>
- </div>
- </div>
- $('button').click(function () {
- var clone= $('.row').last().clone();
- clone.find('option:selected').remove();
- if($(clone).find('option').length>0)
- $('#container').append(clone);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement