I wanted to know how to send mails with javascript and that inside the mail I have a subject and a body to be able to write.
My question is how to add inputs to the function, I know it would be something like this:
$('#input1').val()
To the Jquery function that is the following
$('#element').click(function(){
$(location).attr('href', 'mailto:?subject='
+ encodeURIComponent("This is my subject")
+ "&body="
+ encodeURIComponent("This is my body")
);
});
It is not possible to send an email only with Javascript, you need a "server-side" language that receives the information (for example PHP) to be able to send it.
You can only open the user's mail client, which is what you do with the current code.
As for adding the input values to the href, simply change the texts to the jQuery function you name: