Skip to content

Commit

Permalink
Fix issue #16
Browse files Browse the repository at this point in the history
  • Loading branch information
thdoan committed Jun 9, 2019
1 parent 1cc00b0 commit 554c723
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dist/js/jquery.prettydropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@
}).after($selected);
// Sync <select> element
$('optgroup, option', $select).filter(function() {
// NOTE: .data('value') can return numeric, so using == comparison instead.
return this.value==$li.data('value') || this.text===$li.contents().filter(function() {
// <option>: this.value = this.text, $li.data('value') = $li.contents()
// <option value="">: this.value = "", $li.data('value') = undefined
return (this.value+'|'+this.text)===($li.data('value')||'')+'|'+$li.contents().filter(function() {
// Filter out selected marker
return this.nodeType===3;
}).text();
Expand Down

0 comments on commit 554c723

Please sign in to comment.