Skip to content

Commit

Permalink
Fix issue #4 -- default shown selection is from option.value inst…
Browse files Browse the repository at this point in the history
…ead of ``option.text``
  • Loading branch information
choonkeat committed Mar 18, 2011
1 parent ec37813 commit 4697794
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions demo/index.html
Expand Up @@ -44,7 +44,7 @@ <h2>Demo</h2>
</dt>
<dd>
<select id="select1">
<option>Apple</option>
<option value="1">Apple (1)</option>
<option>Banana
<option>Cherry
<option>Date</option>
Expand All @@ -65,7 +65,7 @@ <h2>Demo</h2>
</dt>
<dd>
<select id="select2" class="yaselect-select">
<option>Apple</option>
<option value="1">Apple (1)</option>
<option>Banana
<option>Cherry
<option>Date</option>
Expand All @@ -86,7 +86,7 @@ <h2>Demo</h2>
</dt>
<dd>
<select id="select3">
<option>Apple</option>
<option value="1">Apple (1)</option>
<option>Banana
<option>Cherry
<option>Date</option>
Expand Down
2 changes: 1 addition & 1 deletion jquery.yaselect.js
Expand Up @@ -18,8 +18,8 @@ jQuery.fn.yaselect = function(options) {
var jselect = jQuery(select).css({position:'absolute',top:0,left:0,zIndex:1}).addClass('yaselect-select'),
wrap = jQuery('<div class="yaselect-wrap yaselect-open" tabindex="0"><div class="yaselect-current"></div></div>'),
anchor = wrap.wrap('<div class="yaselect-anchor" style="position:relative;"></div>').parent(),
curr = wrap.find('.yaselect-current').text(select.value),
gettext = function() { return jselect.find('option:nth(' + (select.selectedIndex || 0) + ')').text(); },
curr = wrap.find('.yaselect-current').text(gettext()),
confirm = function(to_focus_wrap) { jselect.blur(); curr.text(gettext()); jselect.css({top: wrap.outerHeight()}); if (to_focus_wrap) wrap.focus(); };
if (options.hoverOnly || window.navigator && navigator.userAgent.match(/iphone|ipod|ipad/i)) {
wrap.toggleClass('yaselect-open yaselect-close');
Expand Down
6 changes: 3 additions & 3 deletions jquery.yaselect.min.js

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

0 comments on commit 4697794

Please sign in to comment.