Help Text
描述 (Description)
帮助文本用于通知用户元素的用途,通常位于字段下方。 为其提供唯一ID,并将aria-describedby属性添加到输入中。
例子 (Example)
以下示例演示了在Foundation中使用help text 。
<html>
<head>
<title>Form Help Text</title>
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
</head>
<body>
<label>Choose a Password
<input type = "password" aria-describedby = "pwdHelpText">
</label>
<p class = "help-text" id = "pwdHelpText">Password should be at least 8
characters and must include atleast one digit and a special character.</p>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></script>
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>
</body>
</html>
输出 (Output)
让我们执行以下步骤,看看上面给出的代码是如何工作的 -
保存上面给出的html代码form_help_text.html文件。
在浏览器中打开此HTML文件,输出显示如下。