Commit 95e4130a authored by Chris Hynes's avatar Chris Hynes

Support for auto wireup via data-role="multiselect" attribute

parent 68891ec0
...@@ -249,6 +249,10 @@ Additional Styling can be done using the multiselect class: ...@@ -249,6 +249,10 @@ Additional Styling can be done using the multiselect class:
float: right; float: right;
} }
## Usage via data attributes
To hook up the control via data attributes, add the `data-role="multiselect"` attribute to your `<select>`. All selects with that attribute will be automatically wired up on jQuery load.
## Knockout JS Support ## Knockout JS Support
Thanks to [Devristo](https://github.com/Devristo) this plugin supports [Knockout JS](http://knockoutjs.com/). For further discussion see [the pull requests](https://github.com/davidstutz/bootstrap-multiselect/pull/17). Thanks to [Devristo](https://github.com/Devristo) this plugin supports [Knockout JS](http://knockoutjs.com/). For further discussion see [the pull requests](https://github.com/davidstutz/bootstrap-multiselect/pull/17).
......
...@@ -380,24 +380,39 @@ ...@@ -380,24 +380,39 @@
Specifiy an alternaitve label for the options: <code>&lt;option label=&quot;label&quot;&gt;&lt;/option&gt;</code> Specifiy an alternaitve label for the options: <code>&lt;option label=&quot;label&quot;&gt;&lt;/option&gt;</code>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<div class="pull-left"> <div class="pull-left">
<div class="btn-group"> <div class="btn-group">
<select id="example25" multiple="multiple"> <select id="example25" multiple="multiple">
<option value="analysis" label="Ana">Analysis</option> <option value="analysis" label="Ana">Analysis</option>
<option value="algebra" label="LA">Linear Algebra</option> <option value="algebra" label="LA">Linear Algebra</option>
<option value="discrete" label="Discrete">Discrete Mathematics</option> <option value="discrete" label="Discrete">Discrete Mathematics</option>
<option value="numerical" label="NumA">Numerical Analysis</option> <option value="numerical" label="NumA">Numerical Analysis</option>
<option value="probability" label="Proba">Probability Theory</option> <option value="probability" label="Proba">Probability Theory</option>
</select> </select>
</div> </div>
</div> </div>
</td> </td>
<td> <td>
Make the menu drop right instead of dropping left with <code>dropRight</code>. Make the menu drop right instead of dropping left with <code>dropRight</code>.
</td> </td>
</tr> </tr>
<tr>
<td>
<select id="example26" multiple="multiple" data-role="multiselect">
<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>
Using the <code>data-role="multiselect"</code> attribute for automatic wireup.
</td>
</tr>
</table> </table>
<div class="page-header"> <div class="page-header">
<h1>Code</h1> <h1>Code</h1>
......
...@@ -376,4 +376,9 @@ ...@@ -376,4 +376,9 @@
} }
}); });
} }
}(window.jQuery);
$(function()
{
$("select[data-role=multiselect]").multiselect();
});
}(window.jQuery);
\ No newline at end of file
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