我知道它甚至可以在这个站点上工作,但只有当我通过 h1 元素触发它时,我需要通过图像(代表副本)触发它,但是当我尝试它时它根本不起作用。这是我的 Javascript:
$('#copyTxt').click(function(){
alert($('#Txt2Copy').text());
$(this).zclip({
path: '/scripts/js/ZeroClipboard.swf',
copy: $('#Txt2Copy').text(),
afterCopy: function(){
alert($('#Txt2Copy').text() + " was copied to clipboard");
}
});
});
警报只是让我确保它到达并且它不会复制,如果我添加beforeCopy
我确实在那里收到一条消息,但它不会进一步移动。
idcopyTxt
已移动到跨度、img、tr、td 和表本身,但除非我从 H1 触发事件,否则它不会工作。图片所在的 HTML:
<tr>
<td><label for="navUrl">Navigation URL <img id="copyTxt" src="/images/copy.png"/></label></td>
<td id="Txt2Copy"><?= $this->order["order"]["navigationUrl"] ?></td>
</tr>