Commit 1bf82fcd authored by David Stutz's avatar David Stutz

Merge pull request #179 from esdrasedu/master

Add function to customize label of itens.
parents 1da1db9a 72eca522
......@@ -610,6 +610,23 @@
buttonContainer: '<span class="dropdown" />'
});
});
</script>
</pre>
</td>
</tr>
<tr>
<td><code>label</code></td>
<td>Function to write the label of the item.</td>
<td>
<pre class="prettyprint linenums">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$(&#39;.multiselect&#39;).multiselect({
label: function(element) {
return $(element).html()+&#39; (&#39;+$(element).val()+&#39;)&#39;;
}
});
});
&lt;/script&gt;
</pre>
</td>
......
......@@ -91,6 +91,10 @@
return selected.substr(0, selected.length - 2);
}
},
// Create label
label: function( element ){
return $(element).attr('label') || $(element).html();
},
// Is triggered on change of the selected options.
onChange : function(option, checked) {
......@@ -322,7 +326,7 @@
}
// Support the label attribute on options.
var label = $(element).attr('label') || $(element).html();
var label = this.options.label(element);
var value = $(element).val();
var inputType = this.options.multiple ? "checkbox" : "radio";
......
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