Fuzzy Searches Like Sublime or phpstorm Directory Plugin for jQuery

jqueryfuzzy is a lightweight and flexible jQuery fuzzy search plugin that is used to search for text in a dataset using approximate string matching technology.

fuzzy search api search, fuzzy search in javascript, fuzzy search algorithm, fuse js, list js fuzzy search, search algorithm javascript

How to make use of it:

1. Load the jquery.fuzzy.js library after jQuery.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/jquery.fuzzy.js"></script>

2. Create a search field to filter by means of your content.

<input type="text" id="searchBar" />

3. Prepare your dataset as follows:

<div id="dataset">
  <div class="row" id="row1">Content 1</div>
  <div class="row" id="row2">Content 2</div>
  <div class="row" id="row3">Content 3</div>
  ...
</div>
var dataset = [];
var i = 1;
$('div#dataset .row').each(function(){
  dataset.push({title: $(this).text(), id: $(this).attr('id')});
});

4. Call the plugin on the search field to allow the fuzzy search:

$('#searchBar')
  .fuzzy({
    dataset : dataset,
    searchkey: 'title'
  })
  
  .on('fuzzy.clear', function(e, matches){
    // delete previously highlighted rows
    $('.row.highlight').remove();
    // Show rows
    $('div#dataset .row').show();
  })

  .on('fuzzy.search', function(e, matches){
    // Matches will be the same as dataset, except it now has a new key: hlString (highlight string)
    // delete previously highlighted rows
    $('.row.highlight').remove();
    // Hide rows
    $('div#dataset .row').hide();

    var i;
    for (i in matches) {
      var match = matches[i];
      // Use the id to show the highlighted string
      $row = $('<div class="row highlight">'+match['hlString']+'</div>');
      $('#'+match.id).after($row);
    }
});

5. Determine the min variety of characters typed within the search field to activate the fuzzy search performance.

$('#searchBar')
.fuzzy({
  dataset : dataset,
  searchkey: 'title',
  minLength: 1,
})

Simple Online Code Editor! Support React, HTML, CSS, Javascript | PenEditor

Tiny Flexible Fuzzy Search jQuery Plugin, jQuery Fuzzy search plugin/Github


See Demo And Download

Official Website(kedomingo): Click Here

This superior jQuery/javascript plugin is developed by kedomingo. For extra advanced usage, please go to the official website.

Related Posts

svg-pan-zoom-container

Adding Zoom-on-Wheel and Pan-on-Drag to Inline SVG Elements

Vanilla-js module for adding zoom and panning behavior when dragging to SVG embedded elements. A lightweight Vanilla JavaScript plugin that enables zoom and pan functions on an…

html-table-sortable-js

Sorting HTML Table Vanilla JavaScript Library | Sortable.js

Sortable – Small JS vanilla table sorter makes any table with class = “sortable“, er, sortable. That is, the user can click the table header and change…

WYSIWYG-Rich-Text-Editor

WYSIWYG Rich Text Editor With jQuery And FontAwesome | RichText

RichText jQuery implementation for WYSIWYG Rich Text Editor which uses Font Awesome Iconic Font for editor icons. It is licensed under AGPL-3.0. Initialize editor Simply call .richText() on your jQuery(‘textarea’) or jQuery(‘input’)…

email-domain-autocomplete-genie

[Autocomplete] Email Domain Suggestions Like Gmail, Outlook, or More | email-genie

Email Genie allows auto-completion in the email field by providing a list of domain suggestions (gmail.com, outlook.com, etc.). This package is lightweight, flexible, compatible with libraries (jQuery,…

JavaScript-Library-for-Creating-Squircley-Magic

[Generator] JavaScript Library for Creating Squircley Magic ✨ | squircley.js

squircley.js is the core magic of Squirclular ✨ from https://squircley.app wrapped in a simple 0-dependency JavaScript library. squircley.js can generate SVG files, add square backgrounds to DOM…