//= require store/autosuggest
//= require store/spree_core

$ ->
  suggestOn = '<%= Spree::Autosuggest::Config.field %>'

  $("input[name=#{suggestOn}]:not(.ui-autocomplete-input)").live "focus", ->
    new Autosuggest(this,
      from_db: <%= Spree::Autosuggest::Config.rows_from_db %>
      to_display: <%= Spree::Autosuggest::Config.rows_to_display %>
      delay: 100
      minLength: 1
      keyswitch: true )


//= require store/autosuggest
//= require store/spree_core

$ ->
  suggestOn = '<%= Spree::Autosuggest::Config.field %>'

  $("input[name=#{suggestOn}]:not(.ui-autocomplete-input)").on "focus", ->
    new Autosuggest(this,
      from_db: <%= Spree::Autosuggest::Config.rows_from_db %>
      to_display: <%= Spree::Autosuggest::Config.rows_to_display %>
      delay: 100
      minLength: 1
      keyswitch: true )


Update for modern jQuery: Use “on” instead of “live” since “live”
Update for modern jQuery: Use “on” instead of “live” since “live”