Click here to Skip to main content
15,888,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am using multiselect dropdown list and filled items from datbase like below, it is working fine first time, but based on other dropdown selection i need to remove values and add other values.

$('#PID').multiselect({
			columns: 1,
			placeholder: 'Select project'
		});


I am unable to modify dropdown values can any body help me.

I referred the below link.
Multi-select Dropdown List with Checkbox using jQuery - CodexWorld[^]

What I have tried:

$("#PID").append('<option value="option5">Option ' + ++count + '</option>');
  $("#PID").multiselect('refresh');


and reload items, .val('') functions
Posted
Updated 5-Oct-18 10:19am

You are doing a "refresh" command at the end. This won't work because "refresh" is a command in this multiselect plugin[^], but you are using a different one[^]. The fix is simple: instead of "refresh", use "reload":
JavaScript
$("#PID").multiselect('reload');
 
Share this answer
 
Comments
sampath1750 1-Jan-17 5:17am    
Hi,

Thank you for your quick response, it is working .

Thankyou
sampath1750 1-Jan-17 11:28am    
Hi,
If possible Can you help me on checkbox check change event.
Thank you!
Thomas Daniels 1-Jan-17 11:32am    
I don't have a lot of experience with the multiselect tool, but there appears to be an 'onOptionClick' event. See the link to the GitHub repository I provided.
Quote:
Try This Removing Options for Multiple Select Drop Down.

$('#FeatureId').multiselect("deselectAll", false).multiselect("refresh");
 
Share this answer
 
Comments
Richard Deeming 9-Oct-18 13:48pm    
If you'd actually bothered to read the existing solution, you'd see that the "refresh" command is for a different plugin than the one the OP is using.

You'd also see that this question has already been solved.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900