Safari browser mobile text area enter is not allowing new line

Hey friends, I was working on the mobile friendly forms for a paid work. But after the completion of work my client asked me to allow enter to new line in text area when press enter. But I tried jquery script code to put new line on press enter key on the text area. It didn’t worked on the mobile browser like safari.

Then after a lot of google research I found a solution in a website it was working. I inspected that website textarea and copy all the css properties of the text area and pasted in my text area class.

It worked like charm, but I don’t which property of css worked. I just spend 15 min more by deleting one by one properties and at the end found a one line code to fix it.

 textarea {
           white-space: pre-wrap;

By adding above class to text area it worked like charm on safari browser. I tested it on my iphone 6.

Cheers, but don’t forgot to comment if you found it worked and saved your valuable time.

Posted by | View Post | View Group