# copy-the-code/5.5.4/assets/js/copy-inline.js

Copy Anything to Clipboard for WordPress – Copy Button, Copy Text &amp; Copy Code, version 5.5.4. 54 lines.

- Page: https://pluginprobe.com/plugins/copy-the-code/5.5.4/code/assets/js/copy-inline.js
- Raw: https://pluginprobe.com/plugins/copy-the-code/5.5.4/raw/assets/js/copy-inline.js
- Modified: 2026-01-24T18:52:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/copy-the-code/5.5.4/code/assets/js/copy-inline.js#L10-L20`.

```javascript
(function ($) {
	const CTCInline = {

		/**
		 * Init
		 */
		init: function () {
			this._bind();
		},

		/**
		 * Binds events
		 */
		_bind: function () {
			$( document ).on( 'click', '.ctc-inline-copy', this.doCopy );
		},

		/**
		 * Do Copy to Clipboard
		 */
		doCopy: function (event) {
			event.preventDefault();

			const self = $( this )
			let text   = self.find( '.ctc-inline-copy-textarea' ).val() || ''

			// Remove first and last new line.
			text = $.trim( text );

			// Copy to clipboard.
			CTCWP.copy( text );

			// Copied!
			self.addClass( 'copied' );
			setTimeout(
				function () {
					self.removeClass( 'copied' );
				},
				1000
			);
		}
	};

	/**
	 * Initialization
	 */
	$(
		function () {
			CTCInline.init();
		}
	);

})( jQuery );

```
