Preserve line breaks in <textarea> while sending the HTML form data using JavaScript. Hi friends, Hope you are enjoying the time. Today I am posting a small trick about drafting mail to the given user using Javascript. Look at the following simple HTML page. The page includes user email address, subject and message body. I have used <textarea> for getting the message body. You would be knowing that form input fields does not preserve the new line character (pressing "ENTER" button in the textarea ). Here I am writing a simple code to preserve your line break or new line character while submitting the HTML form. Look at the following code: <html> <head> <title> CS-Sending Mail preserving Line breaks in the < textarea > </title> <style> textarea{white-space: pre-wrap;} input{width: 250px; height: 25px; margin-top: 10px; padding: 2px; } .main{width: 1010...
Latest technologies reviews and step by step implementation guide.