No Description

test.html 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Bootstrap-select test page</title>
  5. <meta charset="utf-8">
  6. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  7. <link rel="stylesheet" href="dist/css/bootstrap-select.css">
  8. <style>
  9. body {
  10. padding-top: 70px;
  11. }
  12. </style>
  13. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  14. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
  15. <script src="dist/js/bootstrap-select.js"></script>
  16. </head>
  17. <body>
  18. <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
  19. <div class="container">
  20. <div class="navbar-header">
  21. <a class="navbar-brand" href="#">Bootstrap-select usability tests</a>
  22. </div>
  23. </div>
  24. </nav>
  25. <div class="container">
  26. <form class="form-horizontal" role="form">
  27. <div class="form-group">
  28. <label for="basic" class="col-lg-2 control-label">"Basic" (liveSearch disabled)</label>
  29. <div class="col-lg-10">
  30. <select id="basic" class="selectpicker show-tick form-control">
  31. <option>cow</option>
  32. <option data-subtext="option subtext">bull</option>
  33. <option class="get-class" disabled>ox</option>
  34. <optgroup label="test" data-subtext="optgroup subtext">
  35. <option>ASD</option>
  36. <option selected>Bla</option>
  37. <option>Ble</option>
  38. </optgroup>
  39. </select>
  40. </div>
  41. </div>
  42. </form>
  43. <hr>
  44. <form class="form-horizontal" role="form">
  45. <div class="form-group">
  46. <label for="basic" class="col-lg-2 control-label">"Basic" (liveSearch enabled)</label>
  47. <div class="col-lg-10">
  48. <select id="basic" class="selectpicker show-tick form-control" data-live-search="true">
  49. <option>cow</option>
  50. <option data-subtext="option subtext">bull</option>
  51. <option class="get-class" disabled>ox</option>
  52. <optgroup label="test" data-subtext="optgroup subtext">
  53. <option>ASD</option>
  54. <option selected>Bla</option>
  55. <option>Ble</option>
  56. </optgroup>
  57. </select>
  58. </div>
  59. </div>
  60. </form>
  61. <hr>
  62. <form class="form-horizontal" role="form">
  63. <div class="form-group">
  64. <label for="basic2" class="col-lg-2 control-label">"Basic" (multiple, maxOptions=1)</label>
  65. <div class="col-lg-10">
  66. <select id="basic2" class="show-tick form-control" multiple>
  67. <option>cow</option>
  68. <option>bull</option>
  69. <option class="get-class" disabled>ox</option>
  70. <optgroup label="test" data-subtext="another test">
  71. <option>ASD</option>
  72. <option selected>Bla</option>
  73. <option>Ble</option>
  74. </optgroup>
  75. </select>
  76. </div>
  77. </div>
  78. </form>
  79. <hr>
  80. <form class="form-horizontal" role="form">
  81. <div class="form-group">
  82. <label for="maxOption2" class="col-lg-2 control-label">multiple, show-menu-arrow, maxOptions=2</label>
  83. <div class="col-lg-10">
  84. <select id="maxOption2" class="selectpicker show-menu-arrow form-control" multiple data-max-options="2">
  85. <option>chicken</option>
  86. <option>turkey</option>
  87. <option disabled>duck</option>
  88. <option>goose</option>
  89. </select>
  90. </div>
  91. </div>
  92. </form>
  93. <hr>
  94. <form class="form-inline">
  95. <div class="form-group">
  96. <label class="col-md-1 control-label" for="lunch">Lunch:</label>
  97. </div>
  98. <div class="form-group">
  99. <select id="lunch" class="selectpicker" data-live-search="true" title="Please select a lunch ...">
  100. <option>Hot Dog, Fries and a Soda</option>
  101. <option>Burger, Shake and a Smile</option>
  102. <option>Sugar, Spice and all things nice</option>
  103. <option>Baby Back Ribs</option>
  104. <option>A really really long option made to illustrate an issue with the live search in an inline form</option>
  105. </select>
  106. </div>
  107. </form>
  108. <hr>
  109. <form class="form-horizontal" role="form">
  110. <div class="form-group form-group-lg">
  111. <label for="error" class="col-lg-2 control-label">error</label>
  112. <div class="col-lg-10 error">
  113. <select id="error" class="selectpicker show-tick form-control">
  114. <option>pen</option>
  115. <option>pencil</option>
  116. <option selected>brush</option>
  117. </select>
  118. </div>
  119. </div>
  120. </form>
  121. <hr>
  122. <form class="form-horizontal" role="form">
  123. <div class="form-group has-error form-group-lg">
  124. <label class="control-label col-lg-2" for="country">error type 2</label>
  125. <div class="col-lg-10">
  126. <select id="country" name="country" class="form-control selectpicker">
  127. <option>Argentina</option>
  128. <option>United State</option>
  129. <option>Mexico</option>
  130. </select>
  131. <p class="help-block">No service available in the selected country</p>
  132. </div>
  133. </div>
  134. </form>
  135. <hr>
  136. <nav class="navbar navbar-default" role="navigation">
  137. <div class="container-fluid">
  138. <div class="navbar-header">
  139. <a class="navbar-brand" href="#">Navbar</a>
  140. </div>
  141. <form class="navbar-form navbar-left" role="search">
  142. <div class="form-group">
  143. <select class="selectpicker" multiple data-live-search="true" data-live-search-placeholder="Search" data-actions-box="true">
  144. <optgroup label="filter1">
  145. <option>option1</option>
  146. <option>option2</option>
  147. <option>option3</option>
  148. <option>option4</option>
  149. </optgroup>
  150. <optgroup label="filter2">
  151. <option>option1</option>
  152. <option>option2</option>
  153. <option>option3</option>
  154. <option>option4</option>
  155. </optgroup>
  156. <optgroup label="filter3">
  157. <option>option1</option>
  158. <option>option2</option>
  159. <option>option3</option>
  160. <option>option4</option>
  161. </optgroup>
  162. </select>
  163. </div>
  164. <div class="input-group">
  165. <input type="text" class="form-control" placeholder="Search" name="q">
  166. <div class="input-group-btn">
  167. <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
  168. </div>
  169. </div>
  170. <button type="submit" class="btn btn-default">Search</button>
  171. </form>
  172. </div>
  173. <!-- .container-fluid -->
  174. </nav>
  175. <hr>
  176. <select id="first-disabled" class="selectpicker" data-hide-disabled="true" data-live-search="true">
  177. <optgroup disabled="disabled" label="disabled">
  178. <option>Hidden</option>
  179. </optgroup>
  180. <optgroup label="Fruit">
  181. <option>Apple</option>
  182. <option>Orange</option>
  183. </optgroup>
  184. <optgroup label="Vegetable">
  185. <option>Corn</option>
  186. <option>Carrot</option>
  187. </optgroup>
  188. </select>
  189. <hr>
  190. <select id="first-disabled2" class="selectpicker" multiple data-hide-disabled="true" data-size="5">
  191. <option>Apple</option>
  192. <option>Banana</option>
  193. <option>Orange</option>
  194. <option>Pineapple</option>
  195. <option>Apple2</option>
  196. <option>Banana2</option>
  197. <option>Orange2</option>
  198. <option>Pineapple2</option>
  199. <option>Apple2</option>
  200. <option>Banana2</option>
  201. <option>Orange2</option>
  202. <option>Pineapple2</option>
  203. </select>
  204. <button id="special" class="btn btn-default">Hide selected by disabling</button>
  205. <button id="special2" class="btn btn-default">Reset</button>
  206. <p>Just select 1st element, click button and check list again</p>
  207. <hr>
  208. <div class="input-group">
  209. <span class="input-group-addon">@</span>
  210. <select class="form-control selectpicker">
  211. <option>One</option>
  212. <option>Two</option>
  213. <option>Three</option>
  214. </select>
  215. </div>
  216. <hr>
  217. <div class="input-group">
  218. <span class="input-group-addon">@</span>
  219. <select class="form-control selectpicker" data-mobile="true">
  220. <option>One</option>
  221. <option>Two</option>
  222. <option>Three</option>
  223. </select>
  224. </div>
  225. <p>With <code>data-mobile="true"</code> option.</p>
  226. <hr>
  227. <select id="done" class="selectpicker" multiple data-done-button="true">
  228. <option>Apple</option>
  229. <option>Banana</option>
  230. <option>Orange</option>
  231. <option>Pineapple</option>
  232. <option>Apple2</option>
  233. <option>Banana2</option>
  234. <option>Orange2</option>
  235. <option>Pineapple2</option>
  236. <option>Apple2</option>
  237. <option>Banana2</option>
  238. <option>Orange2</option>
  239. <option>Pineapple2</option>
  240. </select>
  241. <hr>
  242. <div class="form-group">
  243. <label for="tokens">Key words (data-tokens)</label>
  244. <select id="tokens" class="selectpicker form-control" multiple data-live-search="true">
  245. <option data-tokens="first">I actually am called "one"</option>
  246. <option data-tokens="second">And me "two"</option>
  247. <option data-tokens="last">I am "three"</option>
  248. </select>
  249. </div>
  250. <hr>
  251. <form class="form-inline">
  252. <div class="form-group">
  253. <label class="col-md-1 control-label" for="lunchBegins">Lunch (Begins search):</label>
  254. </div>
  255. <div class="form-group">
  256. <select id="lunchBegins" class="selectpicker" data-live-search="true" data-live-search-style="begins" title="Please select a lunch ...">
  257. <option>Hot Dog, Fries and a Soda</option>
  258. <option>Burger, Shake and a Smile</option>
  259. <option>Sugar, Spice and all things nice</option>
  260. <option>Baby Back Ribs</option>
  261. <option>A really really long option made to illustrate an issue with the live search in an inline form</option>
  262. </select>
  263. </div>
  264. </form>
  265. </div>
  266. <script>
  267. $(document).ready(function () {
  268. var mySelect = $('#first-disabled2');
  269. $('#special').on('click', function () {
  270. mySelect.find('option:selected').prop('disabled', true);
  271. mySelect.selectpicker('refresh');
  272. });
  273. $('#special2').on('click', function () {
  274. mySelect.find('option:disabled').prop('disabled', false);
  275. mySelect.selectpicker('refresh');
  276. });
  277. $('#basic2').selectpicker({
  278. liveSearch: true,
  279. maxOptions: 1
  280. });
  281. });
  282. </script>
  283. </body>
  284. </html>