zoukankan      html  css  js  c++  java
  • weui textarea超出字符被截断

    HTML:

    <div class="weui-cells weui-cells_form" style="margin-top: 0;">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <textarea id="doctorIntroduction" class="weui-textarea" placeholder="写答案" rows="3"></textarea>
                <div class="weui-textarea-counter"><span class="textareaLength">0</span>/200</div>
            </div>
       </div>
    </div>

    JS:

    //限制输入字数
                function LimitedWordsNum() {
                    $('#doctorIntroduction').keydown(function() {
                        var curLength = $('#doctorIntroduction').val().length;
                        if(curLength >= 200) {
                            var num = $('#doctorIntroduction').val().substr(0, 200);
                            $('#doctorIntroduction').val(num);
                            weui.alert('超字数限制,多出的字符将被截断!');
                        } else {
                            $('.textareaLength').text(curLength);
                        }
                    })
                }
  • 相关阅读:
    react 采坑记录
    理解JS 模块化
    MongoDB使用教程
    scss
    gulp 使用教程
    node.js 简单入门
    jQuery
    jQuery
    php+mysql+bootstrap 实现成绩管理系统
    SVN的commit功能用bat实现
  • 原文地址:https://www.cnblogs.com/baiyygynui/p/6269329.html
Copyright © 2011-2022 走看看