Vyshnavi Samudrala Vyshnavi Samudrala - 1 year ago 63
jQuery Question

Remove certain option having an index in ddslick

I need to remove an option of ddslick on button click

$('#ddslick_id').ddslick('remove', {index: 0});

This is the link for the code https://jsfiddle.net/5tpy4ofb/17/

Answer Source

I have checked the code for this ddslick plugin at the GitHub page and there is no such method called "remove" which you are trying in your fiddle;

However you can get this sorted out if you go the jQuery way like,


Just in case if you don't to use the selected item and want to delete any one of the item, They have provided a <input type='hidden'...> with a value for every option of the select box, perhaps you can use that as an index, I tried retrieving the value as,

$('#VehicleType .dd-option-selected').find(':input').val();

Hope this helps!