Skip to content

Instantly share code, notes, and snippets.

@daviddanielng
Created November 11, 2025 22:29
Show Gist options
  • Select an option

  • Save daviddanielng/980a75999f3bc4871f7979232ea21580 to your computer and use it in GitHub Desktop.

Select an option

Save daviddanielng/980a75999f3bc4871f7979232ea21580 to your computer and use it in GitHub Desktop.
Fix for the Broken “Copy” Button on the VS Code Marketplace, copy and paste into browser console.
const button = document.getElementById("copy-to-clipboard-button");
if (button) {
button.addEventListener("click", () => {
const content = document.getElementById("vscode-command-input");
if (content) {
navigator.clipboard
.writeText(content.value)
.then(() => {
button.textContent = "Copied!";
setTimeout(() => {
button.textContent = "Copy";
}, 2000);
})
.catch((err) => {
console.error("Failed to copy content: ", err);
button.textContent = "Failed!";
setTimeout(() => {
button.textContent = "Copy";
}, 2000);
});
} else {
button.textContent = "No content!";
setTimeout(() => {
button.textContent = "Copy";
}, 2000);
}
});
} else {
console.error("Button with ID 'copy-to-clipboard-button' not found.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment