문제

Here's the jsfiddle for the code http://jsfiddle.net/VFskn/2/

The jquery multiselect2side has 2 parts for the list say the Available and Selected

a.To get the values of Selected portion of the I used the following code:

var multipleValues = $("#columnList").val() || []; 

b. To get all values of the list I can use:

$('#columnList option').each(function() { 
    columns.push( $(this).attr('value') );
   });

My Question is how I can obtain the Available portion of the list

도움이 되었습니까?

해결책

If I understand your question right, you want to get the value of every option that is in the select under Available?

In the given example this select has the id "columnListms2side__sx", so that you can get the values of its options with

var multipleValues = [];
    $("#columnListms2side__sx option").each(function()
{
    multipleValues.push($(this).val())
});

here's the updated fiddle: http://jsfiddle.net/VFskn/3/

!important notes though: its not a good idea to mess with it, other then the functions provided by the plugin. And I'm not sure how safe it is too assume that this select will allways get this id (e.g. if you have multiple of them in one page). It might be smarter to, build a more generic select. (the plugin seems to create a div container after the select it replaces, you want to get the first select in there)

EDIT: this would be more generic, but less efficient:

$("#columnList").next().find("select").filter(":first").children().each(function(){...}

updated fiddle: http://jsfiddle.net/VFskn/4/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top