Commit 5c3beca3 authored by David Stutz's avatar David Stutz

Added tabindex to button.

parent ffc5a47f
......@@ -135,6 +135,8 @@
enableFiltering: true,
maxHeight: 150
});
$('#example32').multiselect();
});
</script>
<p>
......@@ -482,6 +484,21 @@
The multiselect will adopt the state of the select: <code>&lt;select disabled&gt;&lt;/select&gt;</code>.
</td>
</tr>
<tr>
<td>
<select id="example32" multiple="multiple" tabindex="1">
<option value="cheese">Cheese</option>
<option value="tomatoes">Tomatoes</option>
<option value="mozarella">Mozzarella</option>
<option value="mushrooms">Mushrooms</option>
<option value="pepperoni">Pepperoni</option>
<option value="onions">Onions</option>
</select>
</td>
<td>
The buttin will keep the <code>tabindex</code> of the select.
</td>
</tr>
</table>
<div class="page-header">
<h1>Code</h1>
......
......@@ -41,12 +41,19 @@
this.$container = $(this.options.buttonContainer).append('<button type="button" class="multiselect dropdown-toggle ' + this.options.buttonClass + '" data-toggle="dropdown">' + this.options.buttonText(this.getSelected(), this.$select) + '</button>')
.append('<ul class="multiselect-container dropdown-menu' + (this.options.dropRight ? ' pull-right' : '') + '"></ul>');
// Manually add button width if set.
if (this.options.buttonWidth) {
$('button', this.$container).css({
'width' : this.options.buttonWidth
});
}
// Keep the tab index from the select.
var tabindex = this.$select.attr('tabindex');
if (tabindex) {
$('button', this.$container).attr('tabindex', tabindex);
}
// Set max height of dropdown menu to activate auto scrollbar.
if (this.options.maxHeight) {
// TODO: Add a class for this option to move the css declarations.
......
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