Instantly share code, notes, and snippets.

Embed
What would you like to do?
sample jquery for dynamic display of lunr query results (for jekyll CI post)
$(document).ready(function() {
$('input#search').on('keyup', function () {
var resultdiv = $('#results');
// Get query
var query = $(this).val();
// Search for it
var result = idx.search(query);
// Show results
resultdiv.empty();
for (var item in result) {
var ref = result[item].ref;
var searchitem = '<div class="result"><a href="'+store[ref].link+'">'+store[ref].title+'</a></div>';
resultdiv.append(searchitem);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment