Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support pulling settings from data- attributes on the select. #28

Merged
merged 1 commit into from

2 participants

@benlumley

Small time saver that I'm using - if you like, please merge.

It means you can pass the url and other options as data attributes on the select element.

@benlumley benlumley Fairly small tweak to add support for passing args as data attributes on
the select.

eg:

<select data-url="http://callbackurl">

Works well/saves effort when the urls may change and so have to be parsed out of the
dom somehow.
7104884
@meltingice meltingice referenced this pull request from a commit
@meltingice Compile for pull request #28 b4ce7eb
@meltingice meltingice merged commit 7104884 into meltingice:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 25, 2012
  1. @benlumley

    Fairly small tweak to add support for passing args as data attributes on

    benlumley authored
    the select.
    
    eg:
    
    <select data-url="http://callbackurl">
    
    Works well/saves effort when the urls may change and so have to be parsed out of the
    dom somehow.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/ajax-chosen.coffee
View
2  src/ajax-chosen.coffee
@@ -12,7 +12,7 @@ do ($ = jQuery) ->
chosenXhr = null
# Merge options with defaults
- options = $.extend {}, defaultOptions, settings
+ options = $.extend {}, defaultOptions, $(select).data(), settings
# Load chosen. To make things clear, I have taken the liberty
# of using the .chzn-autoselect class to specify input elements
Something went wrong with that request. Please try again.