Guten Morgen ausgewählt,Eingang select2 entfernen
ich habe:
$(document).ready(function() {
$('select[id$="cbxLocal"]').select2({ placeholder: 'Selecione primeiro uma solicitação', allowClear: true });
$('#cbxLocal').select2({
ajax: {
url: "../Servico/Local.ashx",
dataType: 'json',
type: 'GET',
data: function (term, page) {
return {
q: term,
idTipoLocal: idTipoLocal,
trazerEndereco: 1
};
},
results: function (bond, page) {
return {
results: bond.results
};
}
},
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: 3,
//templateResult: formatRepo, // omitted for brevity, see the source of this page
//templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
});
});
function limparTodosCampos() {
$('select[id$="cbxLocal"]').select2({ placeholder: 'Selecione', allowClear: false, data: null });
}
<label id="divCbxLocal" class="cbxLocal">
<span>Local</span>
<input id="cbxLocal" name="cbxLocal" class="select2" type="text" />
</label>
<fieldset>
<input id="btLimpar" type="button" value="Clear" onclick="limparTodosCampos()" />
</fieldset>
Und ich möchte den Wert von Javascript ausgewählt zurückgesetzt. Wenn ich auf die Schaltfläche "Löschen" klicke, möchte ich den Wert löschen, den der Benutzer in der Combobox ausgewählt hat (select2) Wie mache ich? Die Version select2 ist 2.
Vielen Dank.
Fügen Sie Ihre jQuery/JavaScript. – Pugazh