Below is the jquery function to get selected values in ListBox by iterating loop
$('#btn').click(function(){
var arr = [];
$('.selectpicker :selected').each(function(i, selected){
arr[i] = $(selected).text();
});
alert(arr);
});
var arr = [];
$('.selectpicker :selected').each(function(i, selected){
arr[i] = $(selected).text();
});
alert(arr);
});
If you want retrieve single selected value from list box use below code
$('.selectpicker').val();
No comments:
Post a Comment