My form contains 5 drop-down lists. I'm using JQuery Select2
for each drop-down list
. When I'm trying to edit it only one drop-down list shows previous set value.
My code:
$('.select2').select2({
//placeholder: 'Select an option'
});
if (data.candidateId !== '') {
$("#candidateParentId").select2().select2(data.candidateParentId, data.parent);
$("#candidateTypeId").select2().select2(data.candidateTypeId, data.candidateType);
}
But this code shows only Candidate Parent Value and not Candidate Type value.
I'm getting both values in console.
I just refer to this: How to set selected value of jquery select2?
Any kind of help is appreciated. Thanks in advance.