Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/bootstrap-4-autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface JQuery {
highlightClass: 'text-primary',
};

function createItem(lookup: string, item: AutocompleteItem, opts: AutocompleteOptions):string {
function createItem(lookup: string, item: AutocompleteItem, opts: AutocompleteOptions):JQuery {
let label: string;
if (opts.highlightTyped) {
const idx = item.label.toLowerCase().indexOf(lookup.toLowerCase());
Expand All @@ -39,7 +39,9 @@ interface JQuery {
} else {
label = item.label;
}
return '<button type="button" class="dropdown-item" data-value="' + item.value + '">' + label + '</button>';
const itemEl = $('<button type="button" class="dropdown-item">' + label + '</button>')
itemEl.data('value', item.value)
return itemEl;
}

function expandClassArray(classes: string | string[]): string {
Expand Down