Tuesday, June 2FreeJQuery

Tag: Copy Data to Clipboard

Copy Data to Clipboard Using jQuery
2019, JavaScript, jQuery

Copy Data to Clipboard Using jQuery

Copy Data to Clipboard Using jQuery In this post you find jQuery solution to allow users to copy data to clipboard using jQuery. This solution is quite handy when right click is disabled for your website and also text selection is also disabled. When text selection is disabled along with right click, it’s difficult for users to select the text and then copy it. I hope you can find it useful.Here is the jQuery solution:1 2 3 4 5 6 7$(function() {    $('.allowCopy').click(function() {      $(this).focus();      $(this).select();      document.execCommand('copy');    }); });The above jQuery code will allow click events for all HTML controls with a CSS class “allowCopy” and then select the text and execute document.exec Command(‘copy’); comman...