JavaScriptはクリップボードに直接アクセスできないため、divのテキストをクリップボードにコピーするコピーボタンをWebサイトに配置したいので、そのためにzclipを使用していますが、zclipを非表示の要素にバインドすると、 zclip よりも要素が機能しないか、バインドされていないことを示します。助けてください。
HTML コード:
<span class="homebutton">Get code for this theme</span>
<div class="get_code">
<pre class="theme_code"><?php echo $theme['theme_code'];?></pre>
<div class="copy_code">Copy</div>
</div>
jQuery コード:
$('.homebutton').click(function(){
$('.get_code').show('slow');
});
$('.copy_code').zclip({
path: "js/ZeroClipboard.swf",
copy: function(){return $('.theme_code').text();},
afterCopy: function() {}
});
前もって感謝します!