Skip to content

Commit

Permalink
Merge pull request #52 from michaelperrin/bugfix/jquery-1.9
Browse files Browse the repository at this point in the history
Fix compatibility with jQuery 1.9.x
  • Loading branch information
meltingice committed Feb 7, 2013
2 parents de37a51 + c2948d0 commit cd97514
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/ajax-chosen.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/ajax-chosen.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/ajax-chosen.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ do ($ = jQuery) ->
# into the input form that chosen has created

# Retrieve the current value of the input form
untrimmed_val = $(@).attr('value')
val = $.trim $(@).attr('value')
untrimmed_val = $(@).val()
val = $.trim $(@).val()

# 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
Expand Down Expand Up @@ -139,16 +139,16 @@ do ($ = jQuery) ->
else
# If there are no results, display the no_results text
select.data().chosen.no_results_clear()
select.data().chosen.no_results field.attr('value')
select.data().chosen.no_results field.val()

# Finally, call the user supplied callback (if it exists)
success(data) if success?

# For some reason, the contents of the input field get removed once you
# call trigger above. Often, this can be very annoying (and can make some
# searches impossible), so we add the value the user was typing back into
# the input field.
field.attr('value', untrimmed_val)
field.val(untrimmed_val)

# Because non-ajax Chosen isn't constantly re-building results, when it
# DOES rebuild results (during liszt:updated above, it clears the input
Expand Down

0 comments on commit cd97514

Please sign in to comment.