Created
November 13, 2024 16:47
-
-
Save HubSpotHanevold/71bd2a2475d5658ec73488390a8b4b92 to your computer and use it in GitHub Desktop.
Push URL of page to a form property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
// Wait for the form to load | |
setTimeout(function() { | |
var urlInput = document.querySelector('input[name="url_of_page"]'); | |
if (urlInput) { | |
console.log('url_of_page input exists'); | |
urlInput.value = window.location.href; | |
} | |
},1000); // Adjust the delay if needed | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment