so I'm hoping someone can help. I have a text field on my page which is pulling a variable in from Active Campaign which is the company name, and turning it into a URL on my page:
https://www.vitaldocuments.co.uk/referral-link/?company=%COMPANY%
However, as you can see the variable being pulled in will have spaces in, which is fine in that it's a workable link if they copy and past it, as it will automatically add in %20 into the spaces, but I want these to be added within the text box itself so it shows it as the actual URL here. Is this possible?
Here's the code I'm using:
<script>
    document.querySelectorAll(".copy-link").forEach((copyLinkParent) => {
        const inputField = copyLinkParent.querySelector(".copy-link-input");
        const copyButton = copyLinkParent.querySelector(".copy-link-button");
        const text = inputField.value;
        inputField.addEventListener("focus", () => inputField.select());
        copyButton.addEventListener("click", () => {
            inputField.select();
            navigator.clipboard.writeText(text);
            inputField.value = "Copied!";
            setTimeout(() => (inputField.value = text), 2000);
        });
    });
</script>
-->
I've tried the script as is, but it hasn't worked out right.

 
     
    