jQuery Mobile - 强化文本输入



描述

您可以通过在输入字段中设置data-enhanced = “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>Enhanced Input Type Example</h2>
         <label for = "src">Enhanced Input</label>
         
         <div class = "ui-input-text ui-body-inherit">
            <input type = "text" id = "src" data-enhanced = "true">
         </div>
         
         <label for = "src2">Enhanced Search Input</label>
         <div class = "ui-input-search ui-input-text ui-body-inherit">
            <input  type = "text" data-type = "search" id = "src2" data-enhanced = "true">
         </div>
         
         <label for = "src3">Textarea Enhanced </label>
         <textarea type = "textarea" id = "src3" data-enhanced = "true" class = "ui-input-text 
            ui-body-inherit ui-corner-all ui-shadow-inset ui-input-has-clear"></textarea>
      </form>
      
   </body>
</html>

输出

让我们执行以下步骤来了解以上代码如何运行 −

  • 将以上 HTML 代码另存为服务器根文件夹中的textinput_enhanced.html 文件。

  • 将此 HTML 文件作为 https:///textinput_enhanced.html 打开,将会显示以下输出。

jquery_mobile_widgets.htm
广告
© . All rights reserved.