150 Star 610 Fork 161

yoby / weui

关于表单文本域删除后字数不清零的问题

Done
april  Opened this issue
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            <textarea class="weui-textarea" placeholder="请输入文本" rows="3" onkeyup="textarea(this);"></textarea>
            <div class="weui-textarea-counter"><span>0</span>/<i>10</i></div>
        </div>
        <i class="weui-icon-clear" onclick="cleararea(this)"></i>
    </div>
</div>

以上代码是文本框输入并清空,
在下面代码中,

function cleararea(obj){
            $(obj).prev().find('.weui-textarea').val("");
            return false;
        }

缺少一行关键代码

$(obj).prev().find('.weui-textarea-counter').find('span').text(0);

此代码作用是在点击删除时会初始化字数。

616004 yoby 1578929281 5124653 aprilmrwei 1578980728 total 2 participants

Comments (2)

616004 yoby 1578929281
yoby 2019-09-06 15:30 owner

ok

616004 yoby 1578929281
yoby 2019-09-06 15:36 owner
 function cleararea(obj){
            $(obj).prev().find('.weui-textarea').val("").next().find("span").text(0);
            return false;
        }

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
JavaScript
1
https://git.oschina.net/yoby/weui.git
git@git.oschina.net:yoby/weui.git
yoby
weui
weui

Search

103611 48b8ff67 1899542 103622 4d02230c 1899542