I need to create a simple mailto function so when I click on the html file it brings up my default email application with the composed mail "ready-to-go." I figured a click event on the mailto ID would be sufficient, but it is not firing. What should I do? FYI, I do not want the user to click on the hyperlink. I plan on removing it.
<script type="text/javascript">
$(document).ready(function(){
$("#mymailto").click();
}); // document.ready
</script>
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>Your Title Here</TITLE>
<META http-equiv="X-UA-Compatible" content="IE=edge">
<META http-equiv='cache-control' content='no-cache'>
<META http-equiv='expires' content='0'>
<META http-equiv='pragma' content='no-cache'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</HEAD>
<BODY>
<a href="mailto:[email protected]" id="mymailto" >email</a>
</BODY>
</HTML>
Just use
document.location.href="mailto:[email protected]";
.