Skip to content

Commit

Permalink
Merge pull request #9 from hlindset/fix-select-value-init
Browse files Browse the repository at this point in the history
Fix select options existence predicate
  • Loading branch information
delambo committed Sep 26, 2012
2 parents 29d1203 + 95bb930 commit c624886
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backbone.stickit.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
var optList, list = selectConfig.collection, fieldVal = model.get(modelAttr);

// Get the current selected option value if the select options exist.
if ($el[0].options && $el[0].selectedIndex)
if ($el[0].options.length && $el[0].selectedIndex >= 0)
originalVal = $($el[0].options[$el[0].selectedIndex]).data('stickit_bind_val');

$el.html('');
Expand Down

0 comments on commit c624886

Please sign in to comment.