Created
January 29, 2018 02:18
-
-
Save jasich/bf6c9a21e649252a512780dc358ea9a9 to your computer and use it in GitHub Desktop.
Browser Copy in CLJS
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
(defn copy-text-from-elem | |
[elem-id] | |
(let [elem (.getElementById js/document elem-id)] | |
(.select elem) | |
(try | |
(if (.execCommand js/document "copy") | |
"Copied to Clipboard!!" | |
"Sorry Couldn't Copy") | |
(catch :default e | |
"Sorry Couldn't Copy")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment