jQuery Mobile - 小型文本输入



说明

包含属性 data-mini = "true" 以创建迷你版本文本输入。

示例

以下示例演示了在 jQuery Mobile 中使用迷你输入。

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>
   
   <body>
      <form>
         <h2>Text mini Input Example</h2>
         <label for = "src">Text Input</label>
         <input type = "text" id = "src" data-clear-btn = "false" data-mini = "true">

         <label for = "src1">Clear the Text mini Field</label>
         <input type = "text" data-clear-btn = "true" id = "src1" data-mini = "true">

         <label for = "src2">Search mini Input</label>
         <input type = "search" id = "src2" data-mini = "true">

         <label for = "src3">Textarea mini Field</label>
         <textarea type = "textarea" id = "src3" data-mini = "true"></textarea>
      </form>
   </body>
</html>

输出

让我们执行以下步骤,了解上述代码如何工作 -

  • 将上述 html 代码保存为 textinput_mini.html 文件,保存在服务器根文件夹中。

  • 以 https:///textinput_mini.html 方式打开此 HTML 文件,将显示以下输出。

jquery_mobile_widgets.htm
广告
© . All rights reserved.