troubleshooting Question

select all values from dropdown list

Avatar of lulu50
lulu50Flag for United States of America asked on
jQueryJavaScriptJScript
18 Comments1 Solution639 ViewsLast Modified:
HI,

I want to be able to loop thru my dropdown list and send all values as a list.


Thanks,
Lulu

<select name="SelectDepartmentImpacted" class="SearchBySelect5" id="SelectDepartmentImpacted" style="width: 250px; height: 100px; background-color: rgb(248, 250, 252);" size="180" multiple="" sizzle-1400165879525="[object Object]">

<OPTION value=4 data-DepartmentName="BCN – Commons Customer Service">BCN – Commons Customer Service</OPTION>
<OPTION value=3 data-DepartmentName="BCN">BCN</OPTION>
<OPTION value=7 data-DepartmentName="Customer Service">Customer Service</OPTION>
</select>



		function ResetDepartment ()
	{
		var ResetDept = 'Clear Department';
		var dropdown = $("#DispDepartmentBox");	
			
		var SelDept = $("#SelectDepartmentImpacted option");
		var listDept = "";
		
	$.each(SelDept, function(index, value) {
		if ($('#SelDept').length > 0) 
		{
			//I want to have a list of all my value so I can send it to the URL
			listDept = ? //I want all the list value from the dropdown list like this listDept = (4,3,2,5)
			
			}
	});
		
		
		$('#TxtDepartment').val('');
		
		$.get( "getDepartmentName.cfm?listDept=" + encodeURIComponent(listDept) + "filter=" + encodeURIComponent(ResetDept), function (data) {
			dropdown.html( data );
		});
	}	
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros