Materialize 字符计数器
2018-01-05 15:41 更新
例子
以下示例显示实现字符计数器控件。将长度设置为输入文本或文本区域可激活此控件。
materialize_charactercounter.html
<html> <head> <title>The Materialize DatePicker Example</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script> </head> <body class="container"> <div class="row"> <form class="col s12"> <div class="row"> <div class="input-field col s6"> <input id="name" type="text" length="10"> <label for="name">Enter Name</label> </div> </div> <div class="row"> <div class="input-field col s6"> <textarea id="comments" class="materialize-textarea" length="120"></textarea> <label for="comments">Comments</label> </div> </div> </form> </div> </body> </html>
结果
验证结果,如下图所示。
以上内容是否对您有帮助:
更多建议: