Line break inside HTML tag attribute value
Asked Answered
N

1

12

How can I insert line breaks inside HTML attribute values, like this:

<href="mailto:[email protected]?subject=TestMail&body=Please enter the following details.
Name
Email
Mob No">

When the user replies, the body part should display as below:

Please enter the following details.
1. Name
2. Email
3. Mob No

I tried using <br> tags, but they get displayed.

Nonfeasance answered 8/5, 2012 at 16:6 Comment(0)
M
29

The line break should be URL encoded into %0D%0A

Your mailto will look like:

    <a href="mailto:[email protected]?subject&body=1.Name%0D%0A2.Email">mailme</a>

Info from http://www.cubetoon.com/2008/how-to-enter-line-break-into-mailto-body-command/

Mciver answered 8/5, 2012 at 16:13 Comment(2)
Thanks alot buddy!.. I was afreaid of what to tell my Miss as I was struggling to get this line break done.. U helped me from a big struggleNonfeasance
This is also specified in the 'mailto' URI Scheme RFC 6068.Versicular

© 2022 - 2024 — McMap. All rights reserved.