Skip to content

Instantly share code, notes, and snippets.

@MrJaba
Created October 12, 2012 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrJaba/3878957 to your computer and use it in GitHub Desktop.
Save MrJaba/3878957 to your computer and use it in GitHub Desktop.
Coffee Search
$- >
initializeLinkSearch()
initializeLinkSearch = ->
$("#search").keyup ->
resetLinks()
displayLinksMatching searchTerm()
resetLinks = ->
links = $('.links li a')
links.hide()
displayLinksMatching = (searchTerm) ->
$(".links li a:contains('#{searchTerm}')").show()
$(".links li a.#{searchTerm}").show()
$(".links li a").show() if searchTerm is ''
searchTerm = ->
$('#search').val()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment