mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
MDL-78953 autocomplete: Add only one empty option when deselecting item.
Each option that was deselected was prepending an empty option in the select.
This commit is contained in:
parent
e4d1369475
commit
2d73818742
3 changed files with 5 additions and 3 deletions
2
lib/amd/build/form-autocomplete.min.js
vendored
2
lib/amd/build/form-autocomplete.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -221,7 +221,9 @@ define([
|
|||
var selectedItemValue = $(item).attr('data-value');
|
||||
|
||||
// Preprend an empty option to the select list to avoid having a default selected option.
|
||||
originalSelect.prepend($('<option>'));
|
||||
if (originalSelect.find('option').first().attr('value') !== undefined) {
|
||||
originalSelect.prepend($('<option>'));
|
||||
}
|
||||
|
||||
// Look for a match, and toggle the selected property if there is a match.
|
||||
originalSelect.children('option').each(function(index, ele) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue