Skip to content

Commit

Permalink
Changed to .attr() for setting options selected.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidstutz committed Oct 5, 2013
1 parent 845904b commit 7af40c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 6 additions & 6 deletions js/bootstrap-multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
}

if (checked) {
$option.prop('selected', true);
$option.attr('selected', true);

if (this.options.multiple) {
// Simply select additional option.
Expand All @@ -236,7 +236,7 @@
}

$($checkboxesNotThis).prop('checked', false);
$optionsNotThis.removeAttr('selected').prop('selected', false);
$optionsNotThis.removeAttr('selected').attr('selected', false);

// It's a single selection, so close.
this.$button.click();
Expand All @@ -248,7 +248,7 @@
}
else {
// Unselect option.
$option.removeAttr('selected').prop('selected', false);
$option.removeAttr('selected').attr('selected', false);
}

this.updateButtonText();
Expand Down Expand Up @@ -314,7 +314,7 @@
// Will build an dropdown element for the given option.
createOptionValue: function(element) {
if ($(element).is(':selected')) {
$(element).attr('selected', 'selected').prop('selected', true);
$(element).attr('selected', 'selected').attr('selected', true);
}

// Support the label attribute on options.
Expand Down Expand Up @@ -495,7 +495,7 @@

$checkbox.prop('checked', true);

$option.attr('selected', 'selected').prop('selected', true);
$option.attr('selected', 'selected').attr('selected', true);
this.options.onChange($option, true);
}

Expand All @@ -521,7 +521,7 @@

$checkbox.prop('checked', false);

$option.removeAttr('selected').prop('selected', false);
$option.removeAttr('selected').attr('selected', false);
this.options.onChange($option, false);
}

Expand Down
2 changes: 0 additions & 2 deletions tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@

<link rel="stylesheet" href="css/bootstrap-3.0.0.min.css" type="text/css">
<link rel="stylesheet" href="css/bootstrap-multiselect.css" type="text/css">
<link rel="stylesheet" href="css/prettify.css" type="text/css">

<script type="text/javascript" src="js/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="js/bootstrap-3.0.0.min.js"></script>
<script type="text/javascript" src="js/bootstrap-multiselect.js"></script>
<script type="text/javascript" src="js/prettify.js"></script>
</head>
<body>
<a href="https://github.com/davidstutz/bootstrap-multiselect"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
Expand Down

0 comments on commit 7af40c0

Please sign in to comment.