How to limit the number of characters entered in a text area

后端 未结 6 1371
忘了有多久
忘了有多久 2020-12-10 08:58

Here\'s my attempt at limiting the number of characters entered into a text area:

var limit = 255;
var txt = $(\'textarea[id$=txtPurpose]\');

$(txt).keyup(f         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-10 09:17

    Though this question is pretty old. If I was you I do something very simple like

    
    

    This would limit the users to enter only 255 characters in the textarea.

提交回复
热议问题