Open outlook on button click in jQuery
If you want to send an email on button click instead of hyperlink, you have use window.location. You can also put subject and body text in email. It is very easy onle onle line code like this.
window.location = 'mailto:nirbhay.ni@gmail.com?subject=TestSubject&body=TestBody';
In this section I have also given an example to send mail with hyperlink.
Note: you can send formeted html in body.
CODE
<!DOCTYPE html> <html> <head> <title>jQuery With Example</title> <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $('.btnSendEmail').click(function (event) { var email = 'nirbhay.ni@gmail.com'; var subject = 'Jquery With Example'; var emailBody = 'Hi Nirbhay'; window.location = 'mailto:' + email + '?subject=' + subject + '&body=' + emailBody; }); }); </script> </head> <body> <div> <button class="btnSendEmail">Send Email</button><br /><br /> <a href="mailto:nirbhay.ni@gmail.com?subject=YourSubject&body=Test Body">Mail Me</a> </div> </body> </html>
DISPLAY
Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up.
ReplyDeleteSelenium training in Chennai
Selenium training in Bangalore
I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing..
ReplyDeleteBelieve me I did wrote an post about tutorials for beginners with reference of your blog.
Selenium training in bangalore
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training
Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts.
ReplyDeleteSalesforce Training in Chennai | Certification | Online Course | Salesforce Training in Bangalore | Certification | Online Course | Salesforce Training in Hyderabad | Certification | Online Course | Salesforce Training in Pune | Certification | Online Course | Salesforce Online Training | Salesforce Training
Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up.
ReplyDeletehardware and networking training in chennai
hardware and networking training in omr
xamarin training in chennai
xamarin training in omr
ios training in chennai
ios training in omr
iot training in chennai
iot training in omr
.I just recently discovered your blog and have now scrolled through the entire thing several times. I am very impressed and inspired by your skill and creativity, and your "style" is very much in line with mine. I hope you keep blogging and sharing your design idea
ReplyDeletehadoop training in chennai
hadoop training in velachery
salesforce training in chennai
salesforce training in velachery
c and c plus plus course in chennai
c and c plus plus course in velachery
machine learning training in chennai
machine learning training in velachery