methods.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>jQuery Mobile Docs - Select methods</title>
  7. <link rel="stylesheet" href="../../../jquery.mobile-1.0.1.min.css" />
  8. <link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
  9. <script src="../../../jquery.js"></script>
  10. <script src="../../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
  11. <script src="../../_assets/js/jqm-docs.js"></script>
  12. <script src="../../../jquery.mobile-1.0.1.min.js"></script>
  13. </head>
  14. <body>
  15. <div data-role="page" class="type-interior">
  16. <div data-role="header" data-theme="f">
  17. <h1>Select Menus</h1>
  18. <a href="../../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
  19. </div><!-- /header -->
  20. <div data-role="content">
  21. <div class="content-primary">
  22. <form action="#" method="get">
  23. <h2>Select menus</h2>
  24. <ul data-role="controlgroup" data-type="horizontal" class="localnav">
  25. <li><a href="index.html" data-role="button" data-transition="fade">Basics</a></li>
  26. <li><a href="options.html" data-role="button" data-transition="fade">Options</a></li>
  27. <li><a href="methods.html" data-role="button" data-transition="fade" class="ui-btn-active">Methods</a></li>
  28. <li><a href="events.html" data-role="button" data-transition="fade">Events</a></li>
  29. </ul>
  30. <p>The select menu plugin has the following methods:</p>
  31. <dl>
  32. <dt><code>close</code> close an open select menu</dt>
  33. <dd>
  34. <pre><code>
  35. $('select').selectmenu('close');
  36. </code></pre>
  37. </dd>
  38. <dt><code>enable</code> enable a disabled select</dt>
  39. <dd>
  40. <pre><code>
  41. $('select').selectmenu('enable');
  42. </code></pre>
  43. </dd>
  44. <dt><code>disable</code> disable a select.</dt>
  45. <dd>
  46. <pre><code>
  47. $('select').selectmenu('disable');
  48. </code></pre>
  49. </dd>
  50. <dt><code>open</code> open a closed select menu</dt>
  51. <dd>
  52. <pre><code>
  53. $('select').selectmenu('open');
  54. </code></pre>
  55. </dd>
  56. <dt><code>refresh</code> update the custom select</dt>
  57. <dd>
  58. This is used to update the custom select to reflect the native select element's value.If the number of options in the select are different than the number of items in the custom menu, it'll rebuild the custom menu. Also, if you pass a true argument you can force the rebuild to happen.
  59. <pre><code>
  60. //refresh value
  61. $('select').selectmenu('refresh');
  62. //refresh and force rebuild
  63. $('select').selectmenu('refresh', true);
  64. </code></pre>
  65. </dd>
  66. </dl>
  67. </form>
  68. </div><!--/content-primary -->
  69. <div class="content-secondary">
  70. <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
  71. <h3>More in this section</h3>
  72. <ul data-role="listview" data-theme="c" data-dividertheme="d">
  73. <li data-role="list-divider">Form elements</li>
  74. <li><a href="../docs-forms.html">Form basics</a></li>
  75. <li><a href="../forms-all.html">Form element gallery</a></li>
  76. <li><a href="../textinputs/index.html">Text inputs</a></li>
  77. <li><a href="../search/">Search input</a></li>
  78. <li><a href="../slider/">Slider</a></li>
  79. <li><a href="../switch/">Flip toggle switch</a></li>
  80. <li><a href="../radiobuttons/">Radio buttons</a></li>
  81. <li><a href="../checkboxes/">Checkboxes</a></li>
  82. <li data-theme="a"><a href="index.html">Select menus</a></li>
  83. <li><a href="../forms-themes.html">Theming forms</a></li>
  84. <li><a href="../forms-all-native.html">Native form elements</a></li>
  85. <li><a href="../forms-sample.html">Submitting forms</a></li>
  86. </ul>
  87. </div>
  88. </div>
  89. </div><!-- /content -->
  90. <div data-role="footer" class="footer-docs" data-theme="c">
  91. <p>&copy; 2011-2012 The jQuery Project</p>
  92. </div>
  93. </div><!-- /page -->
  94. </body>
  95. </html>