Commit 0da8ba8e authored by davidstutz's avatar davidstutz

Merged #441 manually plus added documentation.

parent 5d047435
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
* @param {jQuery} element * @param {jQuery} element
* @returns {String} * @returns {String}
*/ */
label: function(element){ optionLabel: function(element){
return $(element).attr('label') || $(element).text(); return $(element).attr('label') || $(element).text();
}, },
/** /**
...@@ -610,7 +610,7 @@ ...@@ -610,7 +610,7 @@
} }
// Support the label attribute on options. // Support the label attribute on options.
var label = this.options.label(element); var label = this.options.optionLabel(element);
var value = $element.val(); var value = $element.val();
var inputType = this.options.multiple ? "checkbox" : "radio"; var inputType = this.options.multiple ? "checkbox" : "radio";
......
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
<h1>Bootstrap Multiselect</h1> <h1>Bootstrap Multiselect</h1>
</div> </div>
<p class="alert alert-info"> <p class="alert alert-warning">
<b>Please see <a href="#known-issues">Known Issues</a>.</b> <b>Some option names may have changed during the last few commits!</b>
</p> </p>
<p class="alert alert-info"> <p class="alert alert-info">
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</p> </p>
<p class="alert alert-info"> <p class="alert alert-info">
<b>Please have a look on <a href="#how-to-contribute">How to contribute?</a> and the <a href="https://github.com/davidstutz/bootstrap-multiselect/issues">Issue Tracker</a>.</b> <b>Please have a look at <a href="#how-to-contribute">How to contribute?</a> and the <a href="https://github.com/davidstutz/bootstrap-multiselect/issues">Issue Tracker</a>.</b>
</p> </p>
<div class="page-header"> <div class="page-header">
...@@ -1254,7 +1254,7 @@ ...@@ -1254,7 +1254,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td><code>label</code></td> <td><code>optionLabel</code></td>
<td> <td>
<p> <p>
A callback used to define the labels of the options. A callback used to define the labels of the options.
...@@ -1263,14 +1263,14 @@ ...@@ -1263,14 +1263,14 @@
<div class="example"> <div class="example">
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#example-label').multiselect({ $('#example-optionLabel').multiselect({
label: function(element) { optionLabel: function(element) {
return $(element).html() + ' (' + $(element).val() + ')'; return $(element).html() + ' (' + $(element).val() + ')';
} }
}); });
}); });
</script> </script>
<select id="example-label" multiple="multiple"> <select id="example-optionLabel" multiple="multiple">
<option value="option-1">Option 1</option> <option value="option-1">Option 1</option>
<option value="option-2">Option 2</option> <option value="option-2">Option 2</option>
<option value="option-3">Option 3</option> <option value="option-3">Option 3</option>
...@@ -1283,8 +1283,8 @@ ...@@ -1283,8 +1283,8 @@
<pre class="prettyprint linenums"> <pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt; &lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() { $(document).ready(function() {
$('#example-label').multiselect({ $('#example-optionLabel').multiselect({
label: function(element) { optionLabel: function(element) {
return $(element).html() + '(' + $(element).val() + ')'; return $(element).html() + '(' + $(element).val() + ')';
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment