diff --git a/coffee/chosen.jquery.coffee b/coffee/chosen.jquery.coffee index 7759b3c3fa6..bad9dbe8fba 100644 --- a/coffee/chosen.jquery.coffee +++ b/coffee/chosen.jquery.coffee @@ -318,7 +318,7 @@ class Chosen extends AbstractChosen this.result_clear_highlight() if $(evt.target).hasClass("active-result") or $(evt.target).parents('.active-result').first() choice_build: (item) -> - choice = $('
', { class: "search-choice" }).html("#{this.choice_label(item)}") + choice = $('', { class: "search-choice", "data-value": item.value }).html("#{this.choice_label(item)}") if item.disabled choice.addClass 'search-choice-disabled' diff --git a/coffee/chosen.proto.coffee b/coffee/chosen.proto.coffee index 19b0ddd83be..f06c90b5159 100644 --- a/coffee/chosen.proto.coffee +++ b/coffee/chosen.proto.coffee @@ -311,7 +311,7 @@ class @Chosen extends AbstractChosen this.result_clear_highlight() if evt.target.hasClassName('active-result') or evt.target.up('.active-result') choice_build: (item) -> - choice = new Element('li', { class: "search-choice" }).update("#{this.choice_label(item)}") + choice = new Element('li', { class: "search-choice", "data-value": item.value }).update("#{this.choice_label(item)}") if item.disabled choice.addClassName 'search-choice-disabled' diff --git a/coffee/lib/abstract-chosen.coffee b/coffee/lib/abstract-chosen.coffee index d0d6e5ed288..258222d66a1 100644 --- a/coffee/lib/abstract-chosen.coffee +++ b/coffee/lib/abstract-chosen.coffee @@ -118,6 +118,7 @@ class AbstractChosen option_el.setAttribute("data-option-array-index", option.array_index) option_el.innerHTML = option.highlighted_html or option.html option_el.title = option.title if option.title + option_el.setAttribute("data-value", option.value); this.outerHTML(option_el)