email javascript get to email code example
Example 1: onclick send to email javascript
function sendMail() {
var link = "mailto:[email protected]"
+ "[email protected]"
+ "&subject=" + encodeURIComponent("This is my subject")
+ "&body=" + encodeURIComponent(document.getElementById('myText').value)
;
window.location.href = link;
}
Example 2: onclick send to email javascript
<textarea id="myText">
Lorem ipsum...
</textarea>
<button onclick="sendMail(); return false">Send</button>