Count bytes in textarea using javascript

后端 未结 10 624
难免孤独
难免孤独 2020-12-02 11:15

I need to count how long in bytes a textarea is when UTF8 encoded using javascript. Any idea how I would do this?

thanks!

10条回答
  •  悲&欢浪女
    2020-12-02 11:22

    I have been asking myself the same thing. This is the best answer I have stumble upon:

    http://www.inter-locale.com/demos/countBytes.html

    Here is the code snippet:

    
    
                                     
                  
提交回复
热议问题