Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Clipboard Copy

I need Clipboard Copy functionality, even i m taking help from http://plugins.jquery.com/project/copy link but it is not working fine.

<li>
     <label class="FieldName">
       Url:
     </label>
     <a id="url" href="<%=Model.FinalPacketUrl %>" target="_blank">
        <%=Model.FinalUrl %></a> </li>
 <li>
     <label class="FieldName">
      Password:
     </label>
 <span id="pwd">
    <%=Model.FinalPassword %></span> </li>

This is my Jquery code.This is just only copy text not text value

  function CopyToClipboard() {
    var text = $("#url").attr("href") + "\n" + $("#pwd").html();
           $.copy(text);
        }

Please help me to fix this problem

like image 625
Pankaj Avatar asked Feb 12 '26 12:02

Pankaj


1 Answers

You may want to try the following plugin:

http://plugins.jquery.com/project/clipboard

like image 169
Arnaud Leymet Avatar answered Feb 15 '26 05:02

Arnaud Leymet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!