Count characters/sms using jQuery

后端 未结 11 1671
醉酒成梦
醉酒成梦 2020-12-08 17:23

I count characters using NobleCount and the following code:

$(\'#message\').NobleCount(\'#messageInfo\',{
            max_chars: getMaxChars(),
            o         


        
11条回答
  •  天命终不由人
    2020-12-08 17:37

      $(function() {        
              $('#message').keydown(function() {
                      var mychars = $('#message').val().length; 
                      var mysms = Math.ceil(mychars / 160);
    
                               console.log (mysms); 
                               console.log (mychars +'' + ' characters'); 
               });
          });
    

提交回复
热议问题