Hi, i manage to do 1 copy button. The problem now how do i make another “copybutton2” with “texttocopy2”. I have tried it but my problem is both button is not functional correctly.
import wixWindow from 'wix-window';
$w.onReady(() => {
$w("#copybutton1").onClick(() => {
let textMessage = $w("#texttocopy1").text;
wixWindow.copyToClipboard(textMessage)
.then(() => {
$w("#copybutton1").disable();
$w("#copybutton1").label = 'Copied!';
returnToDefault();
})
})
});
//Add a function to enable button and change the label after 1 second
function returnToDefault() {
if ($w("#copybutton1").disable()) {
setTimeout(function () {
$w("#copybutton1").enable();
$w("#copybutton1").label = 'Copy Text';
}, 1000)
}
}