The function works well if its only a single box with text. But if I set the value in a repeater it does not work. The console log shows its copied but it doesn’t actually copy anything.
// For full API documentation, including code examples, visit https://wix.to/94BuAAs
import wixWindow from 'wix-window';
// ...
export function button1_click(event) {
// Add your code for this event here:
let textbox = $w('#textBox1').value;
wixWindow.copyToClipboard(textbox)
.then( () => {
console.log("copied");
// handle case where text was copied
} )
.catch( (err) => {
console.log("not copied");
// handle case where an error occurred
} );
}
export function button2_click(event) {
let textbox = $w('#textBox2').value;
wixWindow.copyToClipboard(textbox)
.then( () => {
console.log("copied");
// handle case where text was copied
} )
.catch( (err) => {
console.log("not copied");
// handle case where an error occurred
} ); // Add your code for this event here:
}