Posts

Automatic codebox with copy and download button

Now it would automatically change by default all your codeboxes to this type. No need to add any extra syntax or anything !!
<!--[Demo]-->

<script>

	var a = document.getElementsByClassName('copy-btn');

	for (let i = 0; i < a.length; i++) {

		a[i].addEventListener('click', function () {

			var b = a[i].getAttribute("name");

			var text = document.getElementById(b);

			text.select();

			document.execCommand('copy');

		});

	}

</script>

Post a Comment