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

Posted on 2010-01-08
Last Modified: 2013-11-19
Refer to this question:

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.

<a  onclick="email_foresporsel()"><button>Send forespørsel</button></a> 

The function:


function email_foresporsel(){ 


var subject = "some text"; 

      var body = ""; 



            body = document.getElementById("dinevalgDiv").innerHTML; 




document.location.href = 'mailto:' + encodeURIComponent(subject) + '&body=' + body; 




Open in new window

Question by:granholmen
    LVL 40

    Accepted Solution


    Author Comment

    I did not find an exact answer in the articles reffered above. Anyone familiar with the problem?

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
    Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    The viewer will learn how to dynamically set the form action using jQuery.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now