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

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

jquery-cookie-consent

Simple jQuery Cookie Consent Plugin

jquery.cookie-consent is a simple jQuery plugin to request consent to use cookies. An easy-to-use and highly customizable cookie consent bar that informs your visitors of the use…

Timepicker-Plugin-for-jQuery

Timepicker JavaScript Plugin for jQuery Inspired by Google Calendar

jquery.timepicker is a lightweight jQuery timer plugin inspired by Google Calendar. It supports both mouse and keyboard navigation and weighs 5.5KB minified and compact. Features: Highly customizable…

angular-ngx-carousel-slider

A Lightweight, Touchable, and Responsive Angular Universal Carousel Library

ngxCarousel is a lightweight, tactile, and responsive library for creating an angular carousel. No dependencies, no more hammer. Must Read: Angular Responsive Image Slider With Lightbox Popup…

random-number-picker

Generate a Random Number Picker In Vanilla JavaScript

Random Number Picker is a Vanilla JS-based number picker that allows you to generate a random number within a specified range. Must Read: Generating Lottery Numbers Using…

Nepali-Date-Picker-jQuery-Plugin

Nepali Date Picker jQuery Plugin | nepaliDatePicker

Nepali Date Picker is a customizable, easy-to-use, and input-based date picker plugin mostly based on the Nepali calendar. Users can choose a Nepali date in the navigable…