dimanche 19 février 2017

jQuery UI Multiselect getting all the selected values

I have a jquery multiselect and I intended to get all the checked values before the POST operation, multiselect is created as,

$("#LeadBankTypeMultiselect").multiselect();

The two answers I found here on SO, are only giving me the last checked option and not all the selected options,

First solution I found here,

// lbType is the class of this multiselect
$('select.lbtype > option:selected').each(function() {
alert($(this).val());
});    

Second solution,

alert($("#LeadBankTypeMultiselect").val());

Both seem to give me only the last checked value.




Aucun commentaire:

Enregistrer un commentaire