jQuery page search
Pull request Compare This branch is even with marshill:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
README.rdoc
jquery.search.js

README.rdoc

jQuery Page Search

  • Searches multiple words independantly

  • Highlights results on page (.highlight needs to be defined in css)

  • Collapses items that don't match

  • Fires on keyup in the input field you assign it to.

HTML

<input type="text" id="search" />
<ul id="searchables">
  <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras ultrices ullamcorper tortor.</li>
  <li>Mauris blandit ipsum nec mi. Cras condimentum turpis nec sapien.</li>
  <li>Vestibulum fringilla. Suspendisse placerat, sapien eu vehicula venenatis,</li>
</ul>

JS

<script type="text/javascript" src="jquery.search.js"></script>
<script type="text/javascript" charset="utf-8">
  $("input#search").search("ul#searchables li")
</script>

Credits

shout-out to Johann Burkard for the highlight plugin:

johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html