I have a jQuery form with a text field (Field ID is: 43) for a website URL. When a user inputs either "http://" or "https://" as part of the URL, I need the form to automatically remove the "http://" or "https://" portion before or when the form is submitted.
I cannot seem to get this working. Here is the latest code I have tried (at first, just trying to get it working to remove "http://"
<script type="text/javascript">
document.getElementById("43").setAttribute("onchange", "deleteValue()");
function deleteValue() {
var weburl = 'http://';
var textarea = document.getElementById("43");
var data = textarea.value;
textarea.value = textarea.value.replace(weburl.value, "");
}
</script>
Can anyone provide a suggestion as to how I can get this working?