简体   繁体   中英

Html mailto: HTML e-mail link Open when double click on input field using jQuery .dblclick

I've a following input field for email address. In this field I can edit it's value after click on it. Now I want to double click on it. So it will be open Html mailto: HTML e-mail link . How can I do this ? I used following code. But it's not opening. Any help ?

Html Code:

<tr>
<td>Work Email</td>
<td id="mailto"><input value="<?php echo $res['email'] ?>" type="text" name="email"   
id="email" placeholder="Email address"/></td>
</tr>

Jquery Code:

<script>
$(document).ready(function(){
  $("#mailto").dblclick(function(){   
  <a href="mailto:test@gmail.com?subject=test subject">mail</a>
  });
});
</script>

Try this: HTML :

<table>
<tr>
<td>Work Email</td>
<td id="mailto"><input value="<?php echo $res['email'] ?>" type="text" name="email"   
id="email" placeholder="Email address"/></td>
</tr>
</table>

jQuery :

<script>
$(document).ready(function(){
  $("input#email").dblclick(function(){   
        window.open('mailto:test@gmail.com?subject=test subject');
  });
});
</script>

Fiddle here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM