require.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Bootstrap Multiselect</title>
  5. <meta name="robots" content="noindex, nofollow" />
  6. <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  7. <link rel="stylesheet" href="docs/css/bootstrap-3.3.2.min.css" type="text/css">
  8. <link rel="stylesheet" href="docs/css/prettify.min.css" type="text/css">
  9. <link rel="stylesheet" href="dist/css/bootstrap-multiselect.css" type="text/css">
  10. <link rel="stylesheet" href="docs/css/bootstrap-example.min.css" type="text/css">
  11. <script data-main="dist/js/" src="docs/js/prettify.min.js"></script>
  12. <script data-main="dist/js/" src="docs/js/jquery-2.1.3.min.js"></script>
  13. <script data-main="dist/js/" src="docs/js/bootstrap-3.3.2.min.js"></script>
  14. <script data-main="dist/js/" src="docs/js/require-2.3.5.min.js"></script>
  15. <script type="text/javascript">
  16. $(document).ready(function() {
  17. window.prettyPrint() && prettyPrint();
  18. });
  19. </script>
  20. </head>
  21. <body data-spy="scroll" data-target="#affix">
  22. <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>
  23. <div class="container">
  24. <div class="row">
  25. <div class="col-md-3" id="affix">
  26. <ul class="nav nav-pills nav-stacked sidebar" data-spy="affix" style="margin-top: 40px;">
  27. <li><a href="#getting-started">Getting Started</a></li>
  28. <li><a href="index.html#configuration-options">Configuration Options</a></li>
  29. <li><a href="index.html#templates">Templates</a></li>
  30. <li><a href="index.html#styling">Styling</a></li>
  31. <li><a href="index.html#methods">Methods</a></li>
  32. <li><a href="index.html#further-examples">Further Examples</a></li>
  33. <li><a href="index.html#post">Server-Side Processing</a></li>
  34. <li><a href="index.html#keyboard-support">Keyboard Support</a>
  35. <li class="active"><a href="#require-js">Require JS</a>
  36. <li><a href="index.html#faq">Frequently Asked Questions</a></li>
  37. <li><a href="index.html#known-issues">Known Issues</a></li>
  38. <li><a href="tests/SpecRunner.html">Tests</a></li>
  39. <li><a href="index.html#license">License</a></li>
  40. </ul>
  41. </div>
  42. <div class="col-md-9">
  43. <div class="page-header">
  44. <h1>Bootstrap Multiselect <img src="https://travis-ci.org/davidstutz/bootstrap-multiselect.svg?branch=master" alt="Build Status" /></h1>
  45. <h2 style="display:none;" id="require-js"></h2>
  46. </div>
  47. <p class="alert alert-info">
  48. Please consult the <a href="#faq">FAQ</a>, the <a href="https://github.com/davidstutz/bootstrap-multiselect/issues">Issue Tracker</a> or <a href="http://stackoverflow.com/questions/tagged/bootstrap-multiselect">StackOverflow</a> before creating a new issue; when creating an issue or a pull request, read <a href="#how-to-contribute">how to contribute</a> first.
  49. </p>
  50. <div class="well well-sm">
  51. <p><b>Consider making a donation to support the development of this plugin:</b></p>
  52. <div class="text-center">
  53. <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
  54. <input type="hidden" name="cmd" value="_s-xclick">
  55. <input type="hidden" name="hosted_button_id" value="V95Q7QK6JY32Q">
  56. <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  57. <img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
  58. </form>
  59. </div>
  60. <a href="http://davidstutz.de/donate/" class="small pull-right">Why Donate?</a>
  61. <div class="clearfix"></div>
  62. </div>
  63. <div class="page-header">
  64. <h2 id="require-js">Require JS</h2>
  65. </div>
  66. <p>Getting started with Bootstrap Multiselect and <a href="http://requirejs.org/" target="_blank">Require JS"</a>:</p>
  67. <ol>
  68. <li>
  69. <h3>Link the CSS Files</h3>
  70. <pre class="prettyprint linenums">
  71. &lt;link rel=&quot;stylesheet&quot; href=&quot;css/bootstrap.min.css&quot; type=&quot;text/css&quot;/&gt;
  72. &lt;link rel=&quot;stylesheet&quot; href=&quot;css/bootstrap-multiselect.css&quot; type=&quot;text/css&quot;/&gt;
  73. </pre>
  74. </li>
  75. <li>
  76. <h3>Include Require JS</h3>
  77. <pre class="prettyprint linenums">
  78. &lt;script data-main=&quot;dist/js/&quot; src=&quot;js/require.min.js&quot;&gt;&lt;/script&gt;
  79. </pre>
  80. </li>
  81. <li>
  82. <h3>Create a Select</h3>
  83. <p>
  84. Now simply use HTML to create your <code>select</code> input which you want to turn into a multiselect. Remember to set the <code>multiple</code> attribute as to get a real multiselect - but do not worry, the plugin can also be used as usual select without the <code>multiple</code> attribute being present.
  85. </p>
  86. <pre class="prettyprint linenums">
  87. &lt;!-- Build your select: --&gt;
  88. &lt;select id=&quot;example-getting-started&quot; multiple=&quot;multiple&quot;&gt;
  89. &lt;option value=&quot;cheese&quot;&gt;Cheese&lt;/option&gt;
  90. &lt;option value=&quot;tomatoes&quot;&gt;Tomatoes&lt;/option&gt;
  91. &lt;option value=&quot;mozarella&quot;&gt;Mozzarella&lt;/option&gt;
  92. &lt;option value=&quot;mushrooms&quot;&gt;Mushrooms&lt;/option&gt;
  93. &lt;option value=&quot;pepperoni&quot;&gt;Pepperoni&lt;/option&gt;
  94. &lt;option value=&quot;onions&quot;&gt;Onions&lt;/option&gt;
  95. &lt;/select&gt;
  96. </pre>
  97. </li>
  98. <li>
  99. <h3>Call the Plugin</h3>
  100. <p>
  101. In the end, simply call the plugin on your <code>select</code>:
  102. </p>
  103. <p class="alert alert-info">
  104. Note that in this example, jQuery is included manually due to the file structure of this documentation; however this is not necessary.
  105. </p>
  106. <div class="example">
  107. <script type="text/javascript">
  108. require(["bootstrap-multiselect"],function(purchase){
  109. $('#example-getting-started').multiselect();
  110. });
  111. </script>
  112. <select id="example-getting-started" multiple="multiple">
  113. <option value="cheese">Cheese</option>
  114. <option value="tomatoes">Tomatoes</option>
  115. <option value="Mozzarella">Mozzarella</option>
  116. <option value="Mushrooms">Mushrooms</option>
  117. <option value="Pepperoni">Pepperoni</option>
  118. <option value="Onions">Onions</option>
  119. </select>
  120. </div>
  121. <div class="highlight">
  122. <pre class="prettyprint linenums">
  123. &lt;!-- Initialize the plugin: --&gt;
  124. &lt;script type=&quot;text/javascript&quot;&gt;
  125. require(['bootstrap-multiselect'], function(purchase){
  126. $('#example-getting-started').multiselect();
  127. });
  128. &lt;/script&gt;
  129. </pre>
  130. </div>
  131. </li>
  132. </ol>
  133. <hr>
  134. <p>
  135. &copy; 2012 - 2018
  136. <a href="http://davidstutz.de">David Stutz</a> - dual licensed: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License v2.0</a>, <a href="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</a>
  137. </p>
  138. </div>
  139. </div>
  140. </div>
  141. </body>
  142. </html>