Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
systems:yii2:examples [2018/06/28 16:38]
smayr [Common Behaviors]
systems:yii2:examples [2018/10/04 17:05] (current)
ajdavis [Copy to Clipboard using Javascript]
Line 2959: Line 2959:
 $dataProviderPrice->pagination->pageSizeLimit   = false; $dataProviderPrice->pagination->pageSizeLimit   = false;
 </code>         </code>        
 +
 +== Copy to Clipboard using Javascript ==
 +
 + # Add a reference to the //ClipboardJS// library either by using Yii2 registerJsFile or adding the file to ''assets\AppAsset.php''
 + # Add javascript to your page that creates an instance of ClipboardJS:
 +<code php>$this->registerJs("var clipboard = new ClipboardJS('.btn-clip');", \yii\web\View::POS_END);</code>
 + # Add a button that follows this logic:
 +<code html>
 +<i class="fa fa-copy btn btn-default btn-clip" data-clipboard-text="value-to-copy"></i>
 +</code>