user2515101 user2515101 - 1 year ago 101
HTML Question

Text to Outlook body

I have this button which when clicked opens outlook with the details i have provided. I also have a TEXTAREA which is holding certain texts. I'm looking for a way to have this text appear in the body of my outlook. Can this be done.? Please find code below -

<script type="text/javascript">
$(function () {
$('.btnSendEmail').click(function (event) {
var email = '';
var subject = 'Creation Checklist';
var emailBody = 'Body';
window.location = 'mailto:' + email + '?subject=' + subject + '&body=' + emailBody;

<div id="container">
<TEXTAREA ID="holdtext" rows="10" cols="70">

function ChangeFunction() {
holdtext.innerText = appchange.innerText;

Answer Source

Try changing this line:

var emailBody = 'Body';


var emailBody = $('#holdtext').val();

Because textarea is a form element.. val() is the proper way to retrieve the text inside of it.

Let me know if this helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download