This script is already working but I want to know if it's possible to copy only the "parameter" after the "/" (slash).
My marketing campaigns adds diferents parameters after the "/" do know where the user came from, example: XV-MEL-OM-REVHL-X-X-POP-X-X.
This FORM is one POPUP, and i need to copy on a "hidden" input the parameter after the "/" to know where the user came from.
Script:
<script type="text/javascript">
function Copy()
{
var Url = document.getElementById("paste-box");
Url.value = window.location.href;
Url.focus();
Url.select();
document.execCommand("Copy");
}
HTML:
<form action="https://ws.inversapub.com/subscribe" method="POST" target="hiddenFrame">
<input name="emailAddress" type="email" required="" oninput="this.setCustomValidity('')" oninvalid="this.setCustomValidity('Preencha um endereço de e-mail válido.')" placeholder="Coloque seu e-mail aqui" class="input-email-popup">
<input type="submit" value="QUERO DOBRAR MEU DINHEIRO AINDA ESTE ANO" onclick="Copy();" class="btn-submit-popup om-trigger-conversion">
<input type="hidden" name="sourceId" id="paste-box" value="XV-MEL-OM-REVHL-X-X-POP-X-X">
<input name="listCode" type="hidden" value="inv_hotlist_revhl"/>
<input name="redirect" type="hidden" value="#" />
<input name="email_page" type="hidden" value="inv_welcome_revhl"/>
</form>
My URL is: http://lp.inversapub.com/teste-lp-optin/ It's copying only the /teste-lp-option/
BTW, I'ts possible to add the parameter "XV-MEL-OM-REVHL-X-X-POP-X-X" if thats nothing after the "/"?
Hasta Dhana solution is working! But i need to add the parameters "XV-MEL-OM-REVHL-X-X-POP-X-X" if thats nothing after the "/"