Lifesolvingtools
Monday 4 December 2023
Fake Address Generator
resultContainer.innerHTML = '';
const addressElement = document.createElement('div');
addressElement.classList.add('address');
addressElement.textContent = address;
const copyButton = document.createElement('button');
copyButton.classList.add('copy-button');
copyButton.textContent = 'Copy';
copyButton.addEventListener('click', function () {
copyToClipboard(address);
});
addressElement.appendChild(copyButton);
resultContainer.appendChild(addressElement);
}
function copyToClipboard(text) {
const textarea = document.createElement('textarea');
textarea.value = text;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
alert('Copied to clipboard: ' + text);
}