هناك ثلاثة ملحقات مكون من ملحقات مطلوبة هنا ، وهي:
jquery.js
Zeroclipboard.js
Zeroclipboard.swf
حظ سعيد!
نسخة الكود كما يلي:
<meta charset = "utf-8" />
<button id = "d_clip_button" data-clipboard-arget = "fe_text"> انقر لنسخ </button>
<input id = "fe_text" value = "Testing Text."
<script type = "text/javaScript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script>
<script type = "text/javaScript" src = "zeroclipboard.min.js"> </script>
<script type = "text/javaScript">
$ (وثيقة). ready (function () {
zeroclipboard.setDefaults ({
MoviePath: "Zeroclipboard.swf"
}) ؛
var clip = new Zeroclipboard ($ ("#d_clip_button")) ؛
clip.on ("load" ، function (client) {
console.log ("Zeroclipboard.") ؛
client.on ("كاملة" ، وظيفة (العميل ، args) {
console.log ("تم نسخ المحتوى:" + args.text) ؛
}) ؛
}) ؛
}) ؛
</script>