I'm creating a small site to generate amazon affiliate link using asin I used a small script to generate the URL but I'm looking to copy the output in the clipboard directly.
I looked around without finding a suitable solution for my problem.
Here is the script I'm using to generate the URL.
The HTML part is just an input and a button.
<script>
function myFunction() {
let userInput = document.querySelector("#userInput");
let url = document.querySelector("#url");
url.innerHTML = "https://www.amazon.it/dp/" + userInput.value + "/ref=nosim?tag=altpe-21";
}
</script>