[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

How to exclude html-code when "grabbing" content from a Div with "getElementById"

Refer to this question:
http://www.experts-exchange.com/Programming/Languages/Scripting/JScript/Q_25029954.html

The solution was perfect, but but the function that put the content from a Div into an email, also put the linebreaks, but only as code: <br>

I guess the function must be changed so that the linebreakes will be real linebreakes, not the <br> tags.

The function is to be read in the case refered to above. but I have also posted it here in the code snippet.
HTML-code:
<a  onclick="email_foresporsel()"><button>Send forespørsel</button></a> 

The function:
<SCRIPT LANGUAGE="JavaScript"> 
function email_foresporsel(){ 
     
var subject = "some text"; 
      var body = ""; 
 
      if(document.getElementById("dinevalgDiv")){ 
            body = document.getElementById("dinevalgDiv").innerHTML; 
      } 
 
     
document.location.href = 'mailto: xxxx@domain.com?subject=' + encodeURIComponent(subject) + '&body=' + body; 
} 
 
</sript>

Open in new window

0
granholmen
Asked:
granholmen
1 Solution
 
Gurvinder Pal SinghCommented:
0
 
granholmenAuthor Commented:
I did not find an exact answer in the articles reffered above. Anyone familiar with the problem?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now