0
  • I have provided maxlength=250 attribute to html textarea input.

  • That doesn't allow me to type more than 250 characters.

  • But the problem is when I copy paste data from other site in my textarea and that data has two "\n".
  • Then this will show the count to 250 but In a server side in my php code the length is 254 and It is breaking my code

    < textarea maxlength="250" >

And Input data is :

"PSTD usually lasts up to six months. Yet, there are cases where it lingers on and requires treatment for some particular types of symptoms or behavioural changes.

Treatment for PSTD:

Mindfulness meditation (not a treatment option) helps in recogniz"

If you put this data in text area It will allowed by textarea but when you submit form and inside PHP it will throw error that more than 500 characters not allowed.

Any solution for that ?? I don't want to trim \n from text ...

0 Answers0