Created
June 30, 2017 13:08
-
-
Save kreamweb/8c36b52c75147b98aaea3c6f39424909 to your computer and use it in GitHub Desktop.
copy text in the clipboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $( document ).on( 'click', '.yith-wcbk-copy-to-clipboard', function ( event ) { | |
| var target = $( this ), | |
| selector_to_copy = target.data( 'selector-to-copy' ), | |
| obj_to_copy = $( selector_to_copy ); | |
| if ( obj_to_copy.length > 0 ) { | |
| var temp = $( "<input>" ); | |
| $( 'body' ).append( temp ); | |
| temp.val( obj_to_copy.html() ).select(); | |
| document.execCommand( "copy" ); | |
| temp.remove(); | |
| } | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment