This is similar to this question.
I am currenly trying to capture information froma user inside a textbox and then send this information in the exact format in an email to the owner of the page on submit.
At the moment the email that gets sent through appears on one line.I need to include the line breaks inside the email.
I have the following piece of code and I need to hide the line breaks from the user. Any suggestions would be greatly appreciated.
$("textarea").keypress(function(e){
if (e.keyCode == 13) {
$(this).val( $(this).val() + "<br/>");
//insert a newline
$(this).val($(this).val() + "\n");
alert("just enter was pressed");
return;
}
}
` elements). Second, inserting `
` at the _end_ of the current value doesn't make sense because the user isn't necessarily typing at the end of the field. You should do any processing like this on submit, preferably on the server-side if that's where the email is sent from - can't you take the completed value at that point and replace `\n` with `
` (assuming the emails you're sending are actually in html format)? – nnnnnn Jul 23 '12 at 02:25