A simple script to copy a input value to clipboard, showing a notification and redirecting to a new page.
Install through NPM:
npm install --save @giftomatic/copy-and-go
import { CopyAndGo } from "@giftomatic/copy-and-go";
const copyAndGo = new CopyAndGo({
callback: () => {
document.getElementById("notification")?.classList?.add("active");
},
giftcode: "giftcode",
copyButton: "copy-go",
form: "copy-go-form",
timeout: 3000, // Set to 0 to omit the delay
safariFormTarget: "_self", // Options: "_self" or any other value
});
console.log({ CopyAndGo, copyAndGo });
Or see the full example
import { CopyAndGo } from "https://cdn.jsdelivr.net/npm/@giftomatic/copy-and-go@1/+esm";