Skip to content

Instantly share code, notes, and snippets.

@jharding
Last active August 10, 2020 04:17
Show Gist options
  • Save jharding/9458780 to your computer and use it in GitHub Desktop.
Save jharding/9458780 to your computer and use it in GitHub Desktop.
#custom-templates .empty-message {
padding: 5px 10px;
text-align: center;
}
<div id="custom-templates">
<input class="typeahead" type="text" placeholder="Oscar winners for Best Picture">
</div>
$('#custom-templates .typeahead').typeahead(null, {
name: 'best-pictures',
display: 'value',
source: bestPictures,
templates: {
empty: [
'<div class="empty-message">',
'unable to find any Best Picture winners that match the current query',
'</div>'
].join('\n'),
suggestion: Handlebars.compile('<div><strong>{{value}}</strong> – {{year}}</div>')
}
});
@syabasri
Copy link

Thank you for the link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment