javascript - jquery + coffeescript search box that hides list elements -


i trying create search box hides ul , li elements depending on text.

$(document).ready ->     $('input#barcode').on "keyup", ->         search = $(this).val()         $('li.barcode').each ->             $(this).parent().fadeout('fast') unless $(this).text().indexof search == 0 

i want know how use fat arrows (=>) make code better.

i've fixed it!!

$(document).ready ->     $('#barcode').on "keyup", ->         search = $(@).val()         $('.barcode').each ->             $(@).parent().fadeout('fast') unless $(@).text().indexof(search) == 0 

i still don't know how use fat arrows. , think make code nicer. can me it?

if understand documention, know how/why use fat arrow.

and can try:

$ ->     $('#barcode').on "keyup", ->         search = $(@).val()         $('.barcode').each ->             $(@).parent().fadeout('fast') unless $(@).text() search 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -