Skip to content

Instantly share code, notes, and snippets.

View Sobirbek's full-sized avatar

Sobir Sobirbek

View GitHub Profile
@GarySwift
GarySwift / copy.js
Last active September 19, 2024 15:14
5 ways copy text to clipboard using jQuery (+ JavaScript)
jQuery(document).ready(function($) {
// If a copy clickable input is clicked
// input value will be highlighted and copied to clipboard
$('body').on('click', 'input.js-click-to-copy-input', function(e) {
copy_input( this );
});
// If a button to copy an input is clicked
// associated input value will be highlighted and copied to clipboard
$('body').on('click', 'a.js-click-to-copy-link', function(e) {