0
내가 다중이 방법으로 정의를 선택 한 제거 할 수있는 빈 범위를 추가합니다 옵션이고 다른 하나는 비어 있고 작동하지 않습니다. 이것은 선택 2의 inizialization입니다 :선택 2 내가
$(s).select2({
language: "it",
placeholder: {
id: '-1', // the value of the option
text: 'All'
},
width: '100%',
//multiple: true,
allowClear: true,
ajax: {
delay: 500,
type: "POST",
contentType: "application/json; charset=utf-8",
url: o,
dataType: "json",
cache: 1,
data: function (params) {
var query = JSON.stringify({
country_code: country,
search: params.term
})
return query;
},
processResults: function (t) {
return {
results: $.map(JSON.parse(t.d), function (obj) {
if (obj.city_name == "-") {
return { id: "-1", text: "Tutte" };
}
return { id: obj.city_name, text: obj.city_name };
})
};
},
error: function (t, o, i) {
var n = "Si è verificato un errore. Controlla di aver passato correttamente tutti i parametri.";
//if (t.statusText != null && t.statusText != "")
// n = t.statusText;
"toastr" == a && toastr ? toastr.error(n) : "notific8" == a && $.notific8 ? ($.notific8("zindex", 11500), $.notific8(n, {
theme: "ruby",
life: 3e3
})) : console.log(n)
}
},
minimumInputLength: 2,
});
}
나는 이런 식으로 코드를 실행할 때, 나는 내 크롬 콘솔에서 볼 수있는 두 번째<span>
요소를 생성
그러나 나는 시도하는 경우 내 jQuery 코드에서 삭제하려면 찾을 수 없습니다. 존재하지 않는 것 같습니다. 내가 언급
또 다른 것은 은 내 선택
select2
클래스에 추가하는 경우, 그것은 선택 하나를 생성하지만 아약스가 트리거되지 않는 것입니다.
아니요, 처음으로 비어있는 옵션이 없습니다. –