Reputation: 1426
Everything seems to work fine except when i try to populate to
box...
my code:
Email: <input type="text" id="myTex">
<textarea id="myText">
lorsem ipsum
</textarea>
<button onclick="sendMail(); return false">Send</button>
<script>
function sendMail() {
var link = "&mailto=" + escape(document.getElementById('myTex').value)
+ "[email protected]"
+ "&subject=" + escape("Welcome New agent! ")
+ "&body=" + escape(document.getElementById('myText').value)
;
window.location.href = link;
}</script>
I have a problem with my Email input, it's breaking everything.. perhaps my syntax is wrong? I've tried a few different things but to no avail.. Hopefully it's something simple and i just need another set of eyes. As usual.. any help would be greatly appreciated. thank you.
Upvotes: 0
Views: 3391
Reputation: 34573
I think you want to change
var link = "&to="
to
var link = "mailto:"
Upvotes: 1