Thanks for the fast response.
So just to confirm, I'm working on this page: https://www.little-loves.co.uk/thanksforyourrequest
The block ID for the text we're replacing is #block-c6d10541e56caccb299c (though I've inserted this as 'c6d10541e56caccb299c' is that right)?
And so the code I'm injecting is as follows:
<script>
(function(){
// Place the id of the text block between the quotes of TEXT_BLOCK_ID.
// For information on how to get the text block id, see article below,
// https://www.will-myers.com/articles/what-is-a-block-id-in-squarespace-and-how-to-find-one
var TEXT_BLOCK_ID = 'c6d10541e56caccb299c';
var CONFIRMATION_TEXT = 'Thanks for your Booking';
var PARAMETER_NAME = 'FirstName';
/**************************************************************************
* DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
**************************************************************************/
if (document.readyState == 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
function init(){
TEXT_BLOCK_ID = TEXT_BLOCK_ID.replace('#', '');
var parameterValue = getParameterByName(PARAMETER_NAME);
var textBlock = document.querySelector('#' + TEXT_BLOCK_ID);
if(textBlock && parameterValue){
textBlock.textContent = CONFIRMATION_TEXT + ' ' + parameterValue;
}
}
function getParameterByName(name, url = window.location.href) {
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
})()
</script>
To confirm, it doesn't seem to be working just yet. I imagine there's probably something I've missed? Sorry!!