/docs/forms/texts/events.html

https://github.com/asklion/jquery-mobile · HTML · 101 lines · 77 code · 24 blank · 0 comment · 0 complexity · 065d29fad222b2e83dbd3b627158d882 MD5 · raw file

  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 - Text Input events</title>
  7. <link rel="stylesheet" href="../../../themes/default/" />
  8. <link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
  9. <script src="../../../js/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="../../../js/"></script>
  13. </head>
  14. <body>
  15. <div data-role="page" class="type-interior">
  16. <div data-role="header" data-theme="f">
  17. <h1>Text inputs</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>Text inputs</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">Methods</a></li>
  28. <li><a href="events.html" data-role="button" data-transition="fade" class="ui-btn-active">Events</a></li>
  29. </ul>
  30. <p>Since the native text inputs and textareas are used as a proxy for the custom text inputs, you can watch for events on the original, native text input and textareas instead of needing to go through the text input plugin. Bind to the change event by type: change, blur, focus, keypress, click, etc.</p>
  31. <pre><code>
  32. $( ".selector" ).bind( "change", function(event, ui) {
  33. ...
  34. });
  35. </code></pre>
  36. <p>The text input plugin has the following custom events:</p>
  37. <dl>
  38. <dt><code>create</code> triggered when a text input is created</dt>
  39. <dd>
  40. <p>This event is used to find out when a custom text input was created. It is not used to create a custom text input. The text input create event can be used like this: </p>
  41. <pre><code>
  42. $( ".selector" ).textinput({
  43. create: function(event, ui) { ... }
  44. });
  45. </code></pre>
  46. </dd>
  47. </dl>
  48. </form>
  49. </div><!--/content-primary -->
  50. <div class="content-secondary">
  51. <div data-role="collapsible" data-collapsed="true" data-theme="b">
  52. <h3>More in this section</h3>
  53. <ul data-role="listview" data-theme="c" data-dividertheme="d">
  54. <li data-role="list-divider">Form elements</li>
  55. <li><a href="../docs-forms.html">Form basics</a></li>
  56. <li><a href="../forms-all.html">Form element gallery</a></li>
  57. <li data-theme="a"><a href="index.html">Text inputs</a></li>
  58. <li><a href="../forms-search.html">Search inputs</a></li>
  59. <li><a href="../forms-slider.html">Slider</a></li>
  60. <li><a href="../forms-switch.html">Flip toggle switch</a></li>
  61. <li><a href="../radiobuttons/index.html">Radio buttons</a></li>
  62. <li><a href="../checkboxes/index.html">Checkboxes</a></li>
  63. <li><a href="../selects/index.html">Select menus</a></li>
  64. <li><a href="../forms-themes.html">Theming forms</a></li>
  65. <li><a href="../forms-all-native.html">Native form elements</a></li>
  66. <li><a href="../forms-sample.html">Submitting forms</a></li>
  67. <li><a href="../plugin-eventsmethods.html">Plugin methods</a></li>
  68. </ul>
  69. </div>
  70. </div>
  71. </div><!-- /content -->
  72. <div data-role="footer" class="footer-docs" data-theme="c">
  73. <p>&copy; 2011 The jQuery Project</p>
  74. </div>
  75. </div><!-- /page -->
  76. </body>
  77. </html>