Lars Holtet
Posts: 0
Joined: Sun Nov 24, 2013 5:47 pm

Add static text in javascript with variables, and make line breaks

Hi!

Im currently making an email form that calls some input fields that goes in to the e-mail app on ios.

Looks like this:

Image

The code is like this:

Code: Select all

 var address = confirm("Er du sikker på at alle opplysningene er riktig?");  

 var reportwriter = $('input[dsid="mobiletextinput_12"]').val(); 

 var date = $('input[dsid="mobiletextinput_15"]').val(); 

 var time = $('input[dsid="mobiletextinput_19"]').val(); 

 var details = $('textarea[dsid="mobiletextarea_13"]').val(); 

 if(address == true) { 
     window.location.assign("mailto:a href="mailto:x@gmail.com" rel="nofollow"x@gmail.com/a?Subject= Report" + "&body=" + reportwriter + date + time + details); 
 } 
 else { 
     cancelFormSubmission(); 
 } 

It works well, but i want to include headers in the body in the email so that the reciever of the reporter doesnt end up getting an output like this:

href="https://d2r1vs3d9006ap.cloudfront.net..."Image

How can i make headers between and break lines?

I want the output to be something like this:

Image

Lars Holtet
Posts: 0
Joined: Sun Nov 24, 2013 5:47 pm

Add static text in javascript with variables, and make line breaks

Looking at this page helped :)

var newLine = escape("\n");
var body = "Hello" + newLine +"World";

did it ;)

Return to “Issues”