I'm making an internal page to generate payment links for staff to send to customers. The staff member should be able to input a decimal like 25.99
and that be combined with https://example.com/pay/
to give https://example.com/pay/25.99
<script>
function process() {
var copyText ="https://example.com/pay/" + document.getElementById("paylink").value;
copyText.select();
document.execCommand("copy");
alert("Copied the link: " + copyText.value);
}
</script>
<form onSubmit="return process();">
<p>Enter the amount as a decimal:</p><br>
<input type="text" name="url" id="url"> <input type="submit" value="Get Link" id="paylink">
</form>
I've managed in a different version to send the user to the URL but I want to avoid the need for staff to visit these URLs and just immediately copy it instead.
Any help would be appreciated. Thanks in advance.
UPDATE: This clearly isn't a duplicate, if you read it you'd know that