javascript - Create a function to send mail from a div -
i've several divs email icon.
<div class="icon-send-mail" id="test1@email.com"></div> <div class="icon-send-mail" id="test2@email.com"></div> <div class="icon-send-mail" id="test3@email.com"></div>
i want send email when user clicks on icon.
$( document ).ready( function() { $('.icon-send-mail').click(function(email) { var mailto_link = 'mailto:'+email; var win = window.open(mailto_link,'emailwindow'); }); });
how can done?
you're on right track:
$( document ).ready( function() { $('.icon-send-mail').on('click', function(e) { var mailto_link = 'mailto:' + $(this).attr('id'); var win = window.open(mailto_link, 'emailwindow'); }); });
Comments
Post a Comment