Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dlanileonardo/jquery-live-search

A simple, lightweight jQuery plugin for implement live-search.
https://github.com/dlanileonardo/jquery-live-search

Last synced: 3 months ago
JSON representation

A simple, lightweight jQuery plugin for implement live-search.

Awesome Lists containing this project

README

        

jquery-live-search [![Build Status](https://travis-ci.org/dlanileonardo/jquery-live-search.png?branch=master)](https://travis-ci.org/dlanileonardo/jquery-live-search)
==================

Description:
------------
A simple, lightweight jQuery plugin for implement live-search.

Requirements:
------------

### Simple Usage

```js
$.liveSearch({
selectorContainer: "ul",
selectorElementsToSearch: "li",
attributeToSearch: false,
selectorInputSearch: "#search-query",
selectorToHide: false,
selectorFixed: "li:first",
});
```

#### HTML

```html


  • Header

  • Pernalonga

  • Patolino

  • Eufrazino

  • Lola Bunny

  • Frajola

  • Piu-Piu

  • Taz


```

### Ajax Usage

```js
var objLiveSearch = $.liveSearch({
selectorContainer: "ul",
selectorElementsToSearch: "li",
attributeToSearch: false,
selectorInputSearch: "#search-query",
selectorToHide: "li",
selectorFixed: "li:first",
ajaxCallback: function(){
$.get("helpers/ajax-content.html", function(data){
var search_query = objLiveSearch.getInputSearchVal();
objLiveSearch.ajaxDone(data, search_query);
}, 'html');
},
});
```

#### HTML

```html


  • Header


```

#### HTML Ajax Return:

```html


Ajax Content



  • Header

  • Pernalonga

  • Patolino

  • Eufrazino

  • Lola Bunny

  • Frajola

  • Piu-Piu

  • Taz


```

## Options


Option Name
Description
Type
Default Value


attributeToSearch
Name of the attribute that contains the content to be searched
string
data-search


selectorContainer
Main container of elements
string
table


selectorElementsToSearch
Selector of elements to be searched
string
td


selectorInputSearch
Selector of input field search
string
input#search_query


selectorHead
Selector of the Heads
string
false


selectorToHide
Selector element to be hidden
string
false


minCharacters
Minimum number of characters to trigger the search.
integer
3


typeDelay
Delay time at the end of typing.
integer
500


ajaxFilter
Pass false if Ajax return already filtred.
boolean
true


ajaxCallback
Callback function to custom ajax.
callback
false

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/dlanileonardo/jquery-live-search/trend.png)](https://bitdeli.com/free "Bitdeli Badge")