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);
                    }
                })
            }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM