jQuery Mobile - Disabled 禁用文本输入
描述
属性 disabled = "disabled" 用于禁用输入控件。 该按钮不会接受用户的更改。
示例
下面的示例演示了如何在 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>Disabled Input Type Example</h2>
<label for = "src">Disabled Text Input</label>
<input type = "text" id = "src" disabled = "disabled">
<label for = "src1">Clear the Disabled Field</label>
<input type = "text" data-clear-btn = "true" id = "src1" disabled = "disabled">
<label for = "src2">Disabled Search Input</label>
<input type = "search" id = "src2" disabled = "disabled">
<label for = "src3"> Disabled Textarea</label>
<textarea type = "textarea" id = "src3" disabled = "disabled"></textarea>
</form>
</body>
</html>
输出
让我们执行以下步骤,看看上面的代码是如何工作的 −
将上述 html 代码保存为服务器根文件夹中的 textinput_disabled.html 文件。
将此 HTML 文件打开为 http://localhost/textinput_disabled.html,将显示以下输出。

