diff --git a/README.md b/README.md index 0d6df65..b9abe20 100644 --- a/README.md +++ b/README.md @@ -46,20 +46,6 @@ becomes: -Note: - -Due to a bug in Chosen, it is necessary to change `choosen.css`. - -Add - - display: list-item; - -to - - .chzn-container .chzn-results .group-result { - -class - ### Options There are some additional ajax-chosen specific options you can pass into the first argument to control its behavior. @@ -112,6 +98,8 @@ $("#example-input").ajaxChosen({ return results; }); +Note: Make sure that the given URL returns JSON objects, otherwise function may not be called. You can use the options from $.ajax + ``` ## Developing ajax-chosen diff --git a/src/ajax-chosen.coffee b/src/ajax-chosen.coffee index 74a4fb6..e751060 100644 --- a/src/ajax-chosen.coffee +++ b/src/ajax-chosen.coffee @@ -24,8 +24,8 @@ do ($ = jQuery) -> @each -> # Now that chosen is loaded normally, we can bootstrap it with # our ajax autocomplete code. - $(@).next('.chzn-container') - .find(".search-field > input, .chzn-search > input") + $(@).next('.chosen-container') + .find(".search-field > input, .chosen-search > input") .bind 'keyup', -> # This code will be executed every time the user types a letter # into the input form that chosen has created @@ -37,7 +37,7 @@ do ($ = jQuery) -> # Depending on how much text the user has typed, let them know # if they need to keep typing or if we are looking for their data msg = if val.length < options.minTermLength then options.keepTypingMsg else options.lookingForMsg + " '#{val}'" - select.next('.chzn-container').find('.no-results').text(msg) + select.next('.chosen-container').find('.no-results').text(msg) # If input text has not changed ... do nothing return false if val is $(@).data('prevVal') @@ -135,7 +135,7 @@ do ($ = jQuery) -> if nbItems # Tell chosen that the contents of the