Limit number of characters allowed in form input text field

https://raw.githubusercontent.com/edwardlorilla/VuejsEssentials/857bdb4c3e2f5e81345ba1b733b72846622b8eb9/index.html
{{remain}}/{{limit}}
 h1, div, p, span {
            font-size: 18px;
            font-family: helvetica;
        }
        body {
            padding: 33px;
        }
        span {
            line-height: 20px;
        }
        input {
            line-height: 20px;
            font-size: 18px;
            width: 96px;
        }
        .warning {
            border: red solid 2px;
        }
new Vue({
        el:'#app',
        data:{
            message:'',
            limit:9,
        },
        computed:{
            remain:function(){
                return this.limit - this.message.length
            }
        },
        methods:{
            check:function(){
                if(this.remain<0){
                    this.message = this.message.substr(0,this.limit)
                }
            }
        },
    })

No comments:

The 6 New Rules of Communicating

The era of teleprompters and talking points has come to an end ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *