{ const successMessage = document.createElement('div'); successMessage.textContent = 'Copy succeeded!'; successMessage.style.left = '5px'; successMessage.style.display = 'span'; successMessage.style.fontSize = '12px'; successMessage.style.fontWeight = '200'; successMessage.style.color = '#009A00'; successMessage.style.margin = '5px 0 0 0'; if (!messageDisplayed) { // Check if the message has already been displayed button.insertAdjacentElement('afterend', successMessage); messageDisplayed = true; // Set the variable to true to indicate that the message has been displayed setTimeout(() => { successMessage.remove(); }, 3000); button.addEventListener('click', displayMessage); } }); Native 1080P Full HD Resolution True 500 CVIA Lumens 2000:1 Contrast Ratio 40-120 Inches Screen Powered by Boston Acoustics Dolby Audio Automatic Correction & Focus 2GB RAM and 16GB storage 2.4GHz/5GHz dual-band Wi-Fi & Bluetooth 5.0" />
Use Code at Checkout to Save $100 PGO100Copy Code function copySnippet() { var snippet = document.getElementById("snippet"); var range = document.createRange(); range.selectNode(snippet); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); document.execCommand("copy"); window.getSelection().removeAllRanges(); } let messageDisplayed = false; // Initialize a variable to keep track of whether the message has been displayed const button = document.querySelector('#copycode'); button.addEventListener('click', () => { const successMessage = document.createElement('div'); successMessage.textContent = 'Copy succeeded!'; successMessage.style.left = '5px'; successMessage.style.display = 'span'; successMessage.style.fontSize = '12px'; successMessage.style.fontWeight = '200'; successMessage.style.color = '#009A00'; successMessage.style.margin = '5px 0 0 0'; if (!messageDisplayed) { // Check if the message has already been displayed button.insertAdjacentElement('afterend', successMessage); messageDisplayed = true; // Set the variable to true to indicate that the message has been displayed setTimeout(() => { successMessage.remove(); }, 3000); button.addEventListener('click', displayMessage); } }); Native 1080P Full HD Resolution True 500 CVIA Lumens 2000:1 Contrast Ratio 40-120 Inches Screen Powered by Boston Acoustics Dolby Audio Automatic Correction & Focus 2GB RAM and 16GB storage 2.4GHz/5GHz dual-band Wi-Fi & Bluetooth 5.0