基本的にフォーマットされた形式でさまざまな HTML 要素の内容をコピーするために、zeroclipboard クライアントに渡す選択セットを作成するのに苦労しています。変数から直接クライアントにテキストを渡すことはできますvar myTextToCopy = "Hi, this is the text to copy!";
が、HTML 要素のテキスト コンテンツを機能させることができません。
誰かが私が間違っているところを指摘できますか?
<script src="_assets/js/ZeroClipboard.js" type="text/javascript"></script>
<script language="JavaScript">
var clip = new ZeroClipboard.Client();
var myTextToCopy = $(".sideInfo ul:first-child").text() + "\r\n" + $(".sideInfo ul:nth-child(2)").text() + "\r\n" + $(".sideInfo ul:nth-child(3)").text() + $('.description').text();
clip.setText( myTextToCopy );
clip.glue( 'copyme' );
</script>
<div id="copyme">Copy To Clipboard</div>
<div class="sideInfo">
<ul>
<li>Episode: x</li>
<li>Production house: x</li>
<li>Contacts: Tim nicebutdim<br><a href="mailto:nicebutdim@dot.com">nicebutdim@dot.com</a></li>
</ul>
</div>
<div class="description">
Text text texttext <br /> text text text</div>