I have the following problem:
Script Link
<select id="select2" style="width:250px">
<option value=""></option>
<option value="option 1">Option 1</option>
<option value="option 2">Option 2</option>
<option value="option 3">Option 3</option>
</select>
<input id="disableBtn" type="button" value="Disable" />
<input id="enableBtn" type="button" value="Enable" />
While the selection flag is disabled, the dropout still pops up if a space falls after focusing on the selection field.
Below is the js code:
$('#select2').select2({placeholder: 'Select an option',minimumResultsForSearch: 'Infinity'});
$('#disableBtn').on('click', () => {$('#select2').attr('disabled', 'true');});
$('#enableBtn').on('click', () => {$('#select2').removeAttr('disabled');});
source
share