Help Text

优质
小牛编辑
125浏览
2023-12-01

描述 (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>