Home  >  Q&A  >  body text

javascript - How to set the word limit on Sina Weibo web version


Just like the title.
To add, maybe you don’t understand what I mean, the number of letters and numbers here and the number of Chinese characters are different

代言代言2636 days ago944

reply all(3)I'll reply

  • 扔个三星炸死你

    扔个三星炸死你2017-07-05 10:46:46

    The above is how to write jquery, js can be written like this

    document.getElementById('textarea id').value.length;

    It has been processed, Chinese is counted as 1 characters, and other characters such as English or numbers are counted as 0.5

    Please refer to: http://blog.csdn.net/haison_f...

    reply
    0
  • 代言

    代言2017-07-05 10:46:46

    Since the upper right corner shows how many words have been entered during onchange, it is obviously the value of js monitoring onchange that takes the length

    Just handle it if it exceeds the length

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-07-05 10:46:46

    Get the value of the text box, and then determine the length of the value.

    reply
    0
  • Cancelreply