Skip to content

Instantly share code, notes, and snippets.

@atleastimtrying
Created October 12, 2012 12:23
Show Gist options
  • Save atleastimtrying/3878950 to your computer and use it in GitHub Desktop.
Save atleastimtrying/3878950 to your computer and use it in GitHub Desktop.
Alternative search input functionality
$ ->
allLinks = $ '.links li a'
linksContaing = (searchString)->
$(".links li a:contains('#{searchString}'), .links li a.#{searchString}")
displayLinks = ->
searchString = $(@).val()
if searchString is ''
allLinks.show()
else
allLinks.hide()
linksContaining(searchString).show()
$('#search').keyup displayLinks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment