Code Monkey home page Code Monkey logo

jquery-weui-textarea's Introduction

jquery-weui-textarea

textarea 文本输入框字数提示插件,超出时可限制不再输入。

https://zhuowenli.github.io/jquery-weui-textarea/

Usage

<div class="weui_cells weui_cells_form">
    <div class="weui_cell">
        <div class="weui_cell_bd weui_cell_primary">
            <textarea class="weui_textarea" placeholder="请输入评论" rows="3">aaa</textarea>
            <div class="weui_textarea_counter"><span>0</span>/50</div>
        </div>
    </div>
</div>

PS:计数君需要是跟textarea处在通一层的兄弟元素。

$('.weui_textarea').textarea({
    counter: '.weui_textarea_counter', // 计数选择器
    totalCount: 50,                    // 可输入总数
    enableExceed: false,               // 默认false,允许字符超出,超出则提示。
    onInput: function(res) {           // 输入时触发回调
        console.log(res);
        // {
        //     text: "aaa", // 输入内容
        //     count: 2,    // 字符数,一个汉字一个字符,两个英文及数字等ascii编码为一个字符
        //     type: 0      // 0: 正常, 1: 输入字符数超过了限制的字符总数
        // }
    }
});

jquery-weui-textarea's People

Contributors

zhuowenli avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.