File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 11/* =============================================================
2- * bootstrap-combobox.js v1.1.3
2+ * bootstrap-combobox.js v1.1.4
33 * =============================================================
44 * Copyright 2012 Daniel Farrell
55 *
5757 , map = { }
5858 , source = [ ]
5959 , selected = false
60+ , selectedValue = ''
6061 this . $source . find ( 'option' ) . each ( function ( ) {
6162 var option = $ ( this )
6263 if ( option . val ( ) === '' ) {
6566 }
6667 map [ option . text ( ) ] = option . val ( )
6768 source . push ( option . text ( ) )
68- if ( option . attr ( 'selected' ) ) selected = option . text ( )
69+ if ( option . attr ( 'selected' ) ) {
70+ selected = option . text ( )
71+ selectedValue = option . val ( )
72+ }
6973 } )
7074 this . map = map
7175 if ( selected ) {
7276 this . $element . val ( selected )
77+ this . $target . val ( selectedValue )
7378 this . $container . addClass ( 'combobox-selected' )
7479 this . selected = true
7580 }
Original file line number Diff line number Diff line change @@ -214,9 +214,11 @@ $(function () {
214214 test ( "should set as selected if select was selected before load" , function ( ) {
215215 var $select = $ ( '<select><option></option><option>aa</option><option selected>ab</option><option>ac</option></select>' )
216216 , $input = $select . combobox ( ) . data ( 'combobox' ) . $element
217+ , $target = $select . combobox ( ) . data ( 'combobox' ) . $target
217218 , combobox = $select . data ( 'combobox' )
218219
219220 equal ( $input . val ( ) , 'ab' , 'input value was correctly set' )
221+ equal ( $target . val ( ) , 'ab' , 'hidden input value was correctly set' )
220222 equal ( $select . val ( ) , 'ab' , 'select value was correctly set' )
221223 } )
222224
You can’t perform that action at this time.
0 commit comments