Research and Development

jQuery Live Search Plugin With Support for Multiple Search Urls

Thank you Andreas Lagerkvist for Live Search plugin. iThis will turn a normal form input element in to a live ajax search widget.

I added few configuration options to this plugin:

  • minLength: minimum number of characters
  • width: the number of pixels in the div-element of results. Can also be set to ‘auto’.

We also needed support for multiple search urls when we use it on the Puavo. My changes to this plugin are available on Github. Test and use it and will tell me how it works!

1
2
3
4
5
6
7
8
9
10
11
12
<div id="jquery-live-search-example">
  <form method="post" action="/one-search/">

    <p>
        <label>Enter search terms<br />
          <input id="search" type="text" name="q" />
        </label>
        <input type="submit" value="Go" />
    </p>

  </form>
</div>
1
2
3
4
5
jQuery('#search').liveSearch({
  url: ['/one-serach?q=', '/two-search?q='],
  width: 'auto',
  minLength: 2
});

Comments