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.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src = "https://code.jquery.com/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 文件打开为 http://localhost/textinput_enhanced.html,将显示以下输出。