Page 1 of 1

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

Posted: Thu Jan 05, 2017 5:17 pm
by Lars Holtet

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


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

Posted: Fri Jan 06, 2017 8:31 am
by Serhii Kulibaba

Hello,

Please look at the topic with the same issue: http://stackoverflow.com/questions/56...


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

Posted: Fri Jan 06, 2017 6:36 pm
by Lars Holtet

Looking at this page helped :)

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

did it ;)