--- title: Search | Compass Documentation crumb: Search body_id: search --- - content_for(:javascripts) do %script(type="text/javascript" src="/docs/javascripts/search-data.js") %script(type="text/javascript" src="/docs/javascripts/jquery.url.packed.js") :javascript $(function(){ if ($.url.param("q")) { var query = $.url.param("q").replace("+"," "); $('input#q').attr('value', query); search(query, displayResults); } $('input#q').keyup(function(){ search(this.value, displayResults); }); }) function displayResults(items) { if (items.length > 0) { var html = "" for (var i = 0; i < items.length; i++) { html += '
  • '+items[i].title+'
  • '; } $('ol#results').html(html) } else { $('ol#results').html("
  • Nothing found.
  • "); } } %input#q{:type => "text", :placeholder=>"Search"} %ol#results %li.none Please enter a search term.