如何在Bootstrap中获取未选择的选项值davidstutz / bootstrap-multiselect dro down list

时间:2015-10-17 05:54:35

标签: php jquery bootstrap-multiselect

我正在使用davidstutz / bootstrap-multiselect下拉列表,当我得到一个下拉列表时,我希望得到未选择的值:

$('#Course').multiselect({
    includeSelectAllOption: true,
    nonSelectedText:"Select Dashbord",
    nSelectedText:"Dashbord",
    enableFiltering: true,
    maxHeight:200,
    buttonWidth: '95%',
});
$("#Course").multiselect('selectAll', false);
$("#Course").multiselect('updateButtonText');

在剧本中:

http://graph.facebook.com/{ID of object}/picture

1 个答案:

答案 0 :(得分:0)

我不确定我是否理解你的问题,但这里有一些建议。您可以按如下方式获取所有选定选项的值:

$('#Course option:selected')

同样,您可以获得所有未选择的选项:

$('#Course option:not(:selected)')

可以按如下方式查询相应的输入元素。我假设您使用buttonContainer: '<div id="multiselect-container"></div>'作为简单选项:

// Alternatively use `:not(:selected)` as above:
var value = $('#Course option:selected')[0].val()
$input = $('#multiselect-container input[value="# + value + '"]') // The checkbox
$input.prop('checked`) // Whether it is checked (its checked when the correspondign option is selected)
$input.closest('li') // Corresponding list item
// ...
相关问题