zClipを使用してクリップボードにコピーできるようにする次のjQueryがあります。1つのセレクターだけで問題なく動作しますが、複数のセレクターでは動作しません。$(this)を使用して親を選択しようとしていますが、ブラウザーがクラッシュします。
$('.copylink').zclip({
path:'ZeroClipboard.swf',
copy: jQuery(this).parent().text()
});
これはzClipのWebサイトにある例です
$('a#copy-description').zclip({
path:'js/ZeroClipboard.swf',
copy:$('p#description').text()
});
// The link with ID "copy-description" will copy
// the text of the paragraph with ID "description"
私のHTML
私が使用しようとしているものは、上記のhtmlの親要素のテキストを選択する必要があります
<ul>
<li>the text i will like to select and pull <a href="" class="copylink">Copy</a></li>
<li>the text i will like to select and pull <a href="" class="copylink">Copy</a></li>
<li>the text i will like to select and pull <a href="" class="copylink">Copy</a></li>
<li>the text i will like to select and pull <a href="" class="copylink">Copy</a></li>
<li>the text i will like to select and pull <a href="" class="copylink">Copy</a></li>
</ul>
私の問題は、javascriptオブジェクト内にjQueryを含め、これを使用してスコープ外の値をキャプチャすることにあると思います。