【发布时间】:2011-09-06 08:41:45
【问题描述】:
我知道它甚至可以在这个网站上工作,但只有当我通过 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 我确实会在那里收到一条消息,但它没有进一步移动。
id copyTxt 已移至跨度、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>
【问题讨论】:
-
我确定确实如此。我当时无法评论。这是同样的问题,但有解决方案!
标签: javascript jquery clipboard zclip