copy to clipboard sfdcMonkey

Copy To Clipboard Functionality In Salesforce Lightning Component

Lightning Component

Hi guys, today in this post we are going to learn how we can implement ‘copy to clipboard‘ functionality in salesforce lightning component with client side JavaScript code. with this component you can copy text either from any input field or any hard-code text by clicking on button.

copy to clipboard LC Salesforce

From developer console >> file >> new >> Lightning Component 

Lightning Component : copyToClipboard.cmp

JavaScript Controller : copyToClipboardController.js

JavaScript helper: copyToClipboardHelper.js

  • Check code comments.
TestApp :

From developer console >> file >> new >> Lightning Application

Output :

copy to clipboard LC Salesforce

Other popular Post :

Like our facebook page for new post updates. & Don’t forget to bookmark this site for your future reference.

if you have any suggestions or issue with it, you can post in comment box.

Happy Learning ?

(Visited 2,192 times, 1 visits today)

One thought on “Copy To Clipboard Functionality In Salesforce Lightning Component

  • Excellent.  Except it’s stripping out my newline characters.  Any idea how I can preserve those?

     

     

Leave a Reply